Sha256: 0868a31efff586707b08c47323f7ae1efe85a0daae74ba428ae623a0dfbd60ad

Contents?: true

Size: 605 Bytes

Versions: 2

Compression:

Stored size: 605 Bytes

Contents

#!/usr/bin/env ruby

require 'rubygems'
require 'daemons'
require 'fileutils'

def find_rails_root(dir = Dir.pwd)
  fail 'Rails root not found' if dir == '' || dir == '/' || dir == '.'
  return dir if File.exist?(File.expand_path('config/environment.rb', dir))
  rails_root(File.dirname(dir))
end

rails_root = find_rails_root
dir = File.expand_path('tmp/pids', rails_root)
FileUtils.mkdir_p(dir)
Daemons.run_proc 'tasks_scheduler', dir_mode: :normal, dir: dir do
  ::Dir.chdir(rails_root) do
    require File.join(rails_root, 'config', 'environment')
    ::TasksScheduler::Checker.instance.run
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tasks_scheduler-0.3.0 exe/tasks_scheduler
tasks_scheduler-0.2.3 exe/tasks_scheduler