Skip to content

Instantly share code, notes, and snippets.

@asabirov
Last active December 29, 2015 05:49
Show Gist options
  • Save asabirov/7624440 to your computer and use it in GitHub Desktop.
Save asabirov/7624440 to your computer and use it in GitHub Desktop.
Task for capistrano which reload god configuration. php-resque+god+capistrano
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