Last active
December 29, 2015 05:49
-
-
Save asabirov/7624440 to your computer and use it in GitHub Desktop.
Task for capistrano which reload god configuration. php-resque+god+capistrano
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 :god do | |
def god_command | |
"cd #{current_release}; ENV=#{env} SHARED=#{shared_path} bundle exec god" | |
end | |
def god_is_running | |
!capture("#{god_command} status >/dev/null 2>/dev/null || echo 'not running'").start_with?('not running') | |
end | |
desc "Stop god" | |
task :stop do | |
if god_is_running | |
run "#{god_command} terminate" | |
end | |
end | |
desc "Start god" | |
task :start do | |
run "#{god_command} -c #{current_release}/config/god.rb -l log/god.log" | |
end | |
desc "Restart god" | |
task :restart do | |
god.stop | |
god.start | |
end | |
end | |
before 'deploy:finalize_update', 'god:stop' | |
after 'deploy:finalize_update', 'god:start' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment