mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
Merge branch 'master' of github.com:mperham/sidekiq
This commit is contained in:
commit
1485ad6e85
1 changed files with 19 additions and 6 deletions
|
@ -3,9 +3,19 @@
|
|||
require 'fileutils'
|
||||
|
||||
class Sidekiqctl
|
||||
DEFAULT_TIMEOUT = 10
|
||||
|
||||
attr_reader :stage, :pidfile, :timeout
|
||||
|
||||
def self.print_usage
|
||||
puts
|
||||
puts "Usage: #{File.basename($0)} <command> <pidfile> <timeout>"
|
||||
puts " where <command> is either 'quiet', 'stop' or 'shutdown'"
|
||||
puts " <pidfile> is path to a pidfile"
|
||||
puts " <timeout> is number of seconds to wait till Sidekiq exits (default: #{Sidekiqctl::DEFAULT_TIMEOUT})"
|
||||
puts
|
||||
end
|
||||
|
||||
def initialize(stage, pidfile, timeout)
|
||||
@stage = stage
|
||||
@pidfile = pidfile
|
||||
|
@ -67,12 +77,15 @@ class Sidekiqctl
|
|||
quiet
|
||||
stop
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
stage = ARGV[0]
|
||||
pidfile = ARGV[1]
|
||||
timeout = ARGV[2].to_i
|
||||
timeout = 10 if timeout == 0
|
||||
if ARGV.length < 2
|
||||
Sidekiqctl.print_usage
|
||||
else
|
||||
stage = ARGV[0]
|
||||
pidfile = ARGV[1]
|
||||
timeout = ARGV[2].to_i
|
||||
timeout = Sidekiqctl::DEFAULT_TIMEOUT if timeout == 0
|
||||
|
||||
Sidekiqctl.new(stage, pidfile, timeout)
|
||||
Sidekiqctl.new(stage, pidfile, timeout)
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue