Skip to content

Instantly share code, notes, and snippets.

@kamiller
Last active August 29, 2015 13:57
Show Gist options
  • Save kamiller/9416827 to your computer and use it in GitHub Desktop.
Save kamiller/9416827 to your computer and use it in GitHub Desktop.
capistrano recipe to start/stop/restart daemonized clockwork
# Tasks to start/stop/restart a daemonized clockwork instance
namespace :clockwork do
desc "Start clockwork"
task :start, :roles => [:app] do
run "cd #{current_path} && RAILS_ENV=#{rails_env} bundle exec clockworkd -c #{current_path}/config/clock.rb --pid-dir #{shared_path}/pids --log --log-dir #{shared_path}/log start"
end
task :stop, :roles => [:app] do
run "cd #{current_path} && RAILS_ENV=#{rails_env} bundle exec clockworkd -c #{current_path}/config/clock.rb --pid-dir #{shared_path}/pids --log --log-dir #{shared_path}/log stop"
end
task :restart, :roles => [:app] do
run "cd #{current_path} && RAILS_ENV=#{rails_env} bundle exec clockworkd -c #{current_path}/config/clock.rb --pid-dir #{shared_path}/pids --log --log-dir #{shared_path}/log restart"
end
end
after "deploy:stop", "clockwork:stop"
after "deploy:start", "clockwork:start"
before "deploy:restart", "clockwork:restart"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment