Sha256: 731737c65492575db94ff332ad75b9e1b9b31e69fe4c8ad8b9ece608f9371577

Contents?: true

Size: 624 Bytes

Versions: 6

Compression:

Stored size: 624 Bytes

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

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

def find_rails_root(dir = Dir.pwd)
  raise 'Rails root not found' if ['', '/', '.'].include?(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

6 entries across 6 versions & 1 rubygems

Version Path
tasks_scheduler-0.9.4 exe/tasks_scheduler
tasks_scheduler-0.9.3 exe/tasks_scheduler
tasks_scheduler-0.9.2 exe/tasks_scheduler
tasks_scheduler-0.9.1 exe/tasks_scheduler
tasks_scheduler-0.9.0 exe/tasks_scheduler
tasks_scheduler-0.8.0 exe/tasks_scheduler