lib/sidekiq-bossman.rb in sidekiq-bossman-0.3.0 vs lib/sidekiq-bossman.rb in sidekiq-bossman-0.4.0
- old
+ new
@@ -1,11 +1,11 @@
require 'rubygems'
module Sidekiq
class Bossman
- attr_accessor :config, :pidfile,
+ attr_accessor :config, :daemon, :pidfile,
:logfile, :require,
:timeout, :verbose, :concurrency,
:queue, :queues, :environment
@@ -23,10 +23,11 @@
:environment => "development",
:timeout => 10,
:verbose => false,
:queue => nil,
:queues => [],
+ :daemon => false,
:concurrency => nil}
options = default_options.merge(options)
options.each { |k, v| send("#{k}=", v) }
end
@@ -34,9 +35,10 @@
# Starts the workers as a daemon with either the default or given
# options hash in the initializer
def start_workers
start_cmd = "nohup bundle exec sidekiq -e #{@environment} -t #{@timeout} -P #{@pidfile}"
start_cmd << " -v" if @verbose == true
+ start_cmd << " -d" if @daemon == true
start_cmd << " -r #{@require}" unless @require.nil?
start_cmd << " -C #{@config}" unless @config.nil?
start_cmd << " -q #{@queue}" unless @queue.nil?
@queues.each { |queue| start_cmd << " -q #{queue}" }
start_cmd << " -c #{@concurrency}" unless @concurrency.nil?