Created
August 9, 2011 08:26
-
-
Save yuanying/1133608 to your computer and use it in GitHub Desktop.
CapistranoでUnicornの起動と停止と再起動
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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