Method: Cron::Command#initialize
- Defined in:
- lib/app/jobs/cron/command.rb
#initialize(args) ⇒ Command
Initialize the command
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/app/jobs/cron/command.rb', line 20 def initialize(args) @options = { pid_dir: "#{root}/tmp/pids", log_dir: "#{root}/log", monitor: false } opts = OptionParser.new do |opt| opt. = "Usage: #{File.basename($PROGRAM_NAME)} [options] start|stop|restart|run" opt.on('-h', '--help', 'Show this message') do warn opt exit 1 end opt.on('-e', '--environment=NAME', 'Specifies the environment to run this delayed jobs under (test/development/production).') do warn 'The -e/--environment option has been deprecated and has no effect. Use RAILS_ENV and see http://github.com/collectiveidea/delayed_job/issues/7' end opt.on('--pid-dir=DIR', 'Specifies an alternate directory in which to store the process ids.') do |dir| @options[:pid_dir] = dir end opt.on('--log-dir=DIR', 'Specifies an alternate directory in which to store the delayed_job log.') do |dir| @options[:log_dir] = dir end opt.on('-m', '--monitor', 'Start monitor process.') do @options[:monitor] = true end opt.on('--exit-on-complete', 'Exit when no more jobs are available to run. This will exit if all jobs are scheduled to run in the future.') do @options[:exit_on_complete] = true end opt.on('--daemon-options a, b, c', Array, 'options to be passed through to daemons gem') do || @daemon_options = end end @args = opts.parse!(args) + (@daemon_options || []) end |