Skip to content

Instantly share code, notes, and snippets.

@filiptepper
Created February 21, 2013 13:19
Show Gist options
  • Save filiptepper/5004682 to your computer and use it in GitHub Desktop.
Save filiptepper/5004682 to your computer and use it in GitHub Desktop.
namespace :unicorn do
desc "start unicorn"
task :start, :roles => :app do
run "cd #{current_path} && bundle exec unicorn -c config/unicorn/#{rails_env}.rb -E #{rails_env} -D"
end
desc "stop unicorn"
task :stop, :roles => :app do
run "#{try_sudo} kill -s QUIT `cat #{unicorn_pid}`"
end
desc "restart unicorn"
task :restart, :roles => :app do
top.unicorn.stop
top.unicorn.start
end
desc "reload unicorn (gracefully restart workers)"
task :reload, :roles => :app do
run "#{try_sudo} kill -s USR2 `cat #{unicorn_pid}`"
end
desc "reconfigure unicorn (reload config and gracefully restart workers)"
task :reconfigure, :roles => :app do
run "#{try_sudo} kill -s HUP `cat #{unicorn_pid}`"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment