Skip to content

Instantly share code, notes, and snippets.

@inferno
Created December 19, 2013 13:30
Show Gist options
  • Select an option

  • Save inferno/8039110 to your computer and use it in GitHub Desktop.

Select an option

Save inferno/8039110 to your computer and use it in GitHub Desktop.
namespace :unicorn do
set :unicorn_pid, "#{app_path}/tmp/pids/unicorn.pid"
desc "Restart unicorn"
task :restart => :environment do
queue %{
cd #{app_path}
test -s "#{unicorn_pid}" && kill -USR2 `cat "#{unicorn_pid}"` && echo "-----> Reload Ok" && exit 0
bundle exec unicorn -c #{app_path}/config/unicorn.rb -E #{rails_env} -D && echo "-----> Start Ok"
}
end
desc "Stop unicorn"
task :stop do
queue 'echo "-----> Stop Unicorn"'
queue! %{
test -s "#{unicorn_pid}" && kill -QUIT `cat "#{unicorn_pid}"` && echo "Stop Ok" && exit 0
echo >&2 "Not running"
}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment