Module: Resque::Pool::CLI

Defined in:
lib/resque/pool/cli_patches.rb

Overview

Command Line Interface monkey patch for resque-pool

Class Method Summary collapse

Class Method Details

.parse_optionsObject

rubocop:disable all



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
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/resque/pool/cli_patches.rb', line 26

def parse_options
  opts = Trollop::options do
    version "resque-pool #{VERSION} (c) nicholas a. evans"
    banner "resque-pool is the best way to manage a group (pool) of resque workers\n\nWhen daemonized, stdout and stderr default to resque-pool.stdxxx.log files in\nthe log directory and pidfile defaults to resque-pool.pid in the current dir.\n\nUsage:\n   resque-pool [options]\nwhere [options] are:\n    EOS\n    opt :config, 'Alternate path to config file', type: String, short: '-c'\n    opt :appname, 'Alternate appname',         type: String,    short: '-a'\n    opt :daemon, 'Run as a background daemon', default: false,  short: '-d'\n    opt :stdout, 'Redirect stdout to logfile', type: String,    short: '-o'\n    opt :stderr, 'Redirect stderr to logfile', type: String,    short: '-e'\n    opt :nosync, 'Don\\'t sync logfiles on every write'\n    opt :pidfile, 'PID file location', type: String,    short: '-p'\n    opt :environment, 'Set RAILS_ENV/RACK_ENV/RESQUE_ENV', type: String, short: '-E'\n    opt :spawn_delay, 'Delay in milliseconds between spawning missing workers', type: Integer, short: '-s'\n    opt :term_graceful_wait, 'On TERM signal, wait for workers to shut down gracefully'\n    opt :term_graceful,     'On TERM signal, shut down workers gracefully'\n    opt :term_immediate,     'On TERM signal, shut down workers immediately (default)'\n    opt :single_process_group, 'Workers remain in the same process group as the master', default: false\n    opt :cluster, 'Name of the cluster this resque-pool belongs to', type: String, short: '-C'\n    opt :global_config, 'Alternate path to the global config file', type: String, short: '-G'\n  end\n  if opts[:daemon]\n    opts[:stdout] ||= 'log/resque-pool.stdout.log'\n    opts[:stderr] ||= 'log/resque-pool.stderr.log'\n    opts[:pidfile] ||= 'tmp/pids/resque-pool.pid'\n  end\n  opts\nend\n"