Skip to content

Instantly share code, notes, and snippets.

@trivektor
Forked from tsmango/deploy.rb
Created March 17, 2012 04:07
Show Gist options
  • Save trivektor/2054837 to your computer and use it in GitHub Desktop.
Save trivektor/2054837 to your computer and use it in GitHub Desktop.
...
# Restart Passenger
deploy.task :restart, :roles => :app do
...
# Restart the resque workers
run "cd #{current_path} && rake queue:restart_workers RAILS_ENV=production"
end
namespace :queue do
task :restart_workers => :environment do
pids = Array.new
Resque.workers.each do |worker|
pids << worker.to_s.split(/:/).second
end
if pids.size > 0
system("kill -QUIT #{pids.join(' ')}")
end
system("rm /var/run/god/resque-1.8.0*.pid")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment