Skip to content

Instantly share code, notes, and snippets.

@michaelgrafl
Created May 31, 2012 15:31
Show Gist options
  • Save michaelgrafl/2844179 to your computer and use it in GitHub Desktop.
Save michaelgrafl/2844179 to your computer and use it in GitHub Desktop.
Unicorn control via Capistrano tasks
task :start, :roles => :app, :except => { :no_release => true } do
run "cd #{current_path} && bundle exec #{unicorn_binary} -c #{unicorn_config} -E production -D"
end
task :stop, :roles => :app, :except => { :no_release => true } do
run "kill `cat #{unicorn_pid}`"
end
task :graceful_stop, :roles => :app, :except => { :no_release => true } do
run "kill -s QUIT `cat #{unicorn_pid}`"
end
task :reload, :roles => :app, :except => { :no_release => true } do
run "kill -s USR2 `cat #{unicorn_pid}`"
end
task :restart, :roles => :app, :except => { :no_release => true } do
stop
start
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment