#!/usr/bin/env ruby # frozen_string_literal: true require 'rubygems' require 'daemons' 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 require File.join(rails_root, 'config', 'environment') ::ScheduledTask.find(ARGV[0].to_i).run