Skip to content

Instantly share code, notes, and snippets.

@yuanying
Created August 9, 2011 08:26
Show Gist options
  • Save yuanying/1133608 to your computer and use it in GitHub Desktop.
Save yuanying/1133608 to your computer and use it in GitHub Desktop.
CapistranoでUnicornの起動と停止と再起動
namespace :deploy do
unicorn_start_script = "cd #{current_path} && BUNDLE_GEMFILE=#{current_path}/Gemfile bundle exec unicorn_rails -c #{current_path}/config/unicorn.rb -E production -D"
task :start, :roles => :app, :except => { :no_release => true } do
run "#{unicorn_start_script}"
end
task :stop, :roles => :app, :except => { :no_release => true } do
run "kill -KILL -s QUIT `cat #{shared_path}/pids/unicorn.pid`"
end
task :restart, :roles => :app, :except => { :no_release => true } do
run "if [ -e #{shared_path}/pids/unicorn.pid ]; then kill -USR2 `cat #{shared_path}/pids/unicorn.pid`; else #{unicorn_start_script}; fi"
# run "kill -USR2 `cat #{shared_path}/pids/unicorn.pid`"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment