lib/tasks/resque.rake
# Start worker(s) with proper env vars and output redirection
Start worker(s) with proper env vars and output redirection
Start worker ( s ) with proper env vars and output redirection
def run_worker(queue, count = 1)
    puts "Starting #{count} worker(s) with QUEUE: #{queue}"
    ops = {:pgroup => true, :err => [(Rails.root + "log/resque_err.log").to_s, "a"],
                            :out => [(Rails.root + "log/resque_stdout.log").to_s, "a"]}
    env_vars = {"QUEUE" => queue.to_s, 'RAILS_ENV' => Rails.env.to_s}
    count.times do
      pid = spawn(env_vars, "rake resque:work", ops)
      Process.detach(pid)
      puts "Started worker with PID #{ pid }"
    end
  end
def run_worker ( queue , count = 1 ) puts "Starting #{count} worker(s) with QUEUE: #{queue}" ops = { :pgroup => true , :err => [ ( Rails . root + "log/resque_err.log" ) . to_s , "a" ] , :out => [ ( Rails . root + "log/resque_stdout.log" ) . to_s , "a" ] } env_vars = { "QUEUE" => queue . to_s , 'RAILS_ENV' => Rails . env . to_s } count . times do pid = spawn ( env_vars , "rake resque:work" , ops ) Process . detach ( pid ) puts "Started worker with PID #{ pid }" end end
Start worker(s) with proper env vars and output redirection
Start worker ( s ) with proper env vars and output redirection
##  make sure log/resque_err, log/resque_stdout are writable. # pids = [] ## Using Kernel.spawn and Process.detach because regular system() call would ## cause the processes to quit when capistrano finishes
queue
<not_specific>
count
<not_specific>