Skip to content

Instantly share code, notes, and snippets.

@thermistor
Created October 24, 2013 19:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thermistor/7143397 to your computer and use it in GitHub Desktop.
Save thermistor/7143397 to your computer and use it in GitHub Desktop.
Delayed Job tasks for Capistrano 3, save in lib/capistrano/tasks.
namespace :delayed_job do
def args
fetch(:delayed_job_args, "")
end
def delayed_job_roles
fetch(:delayed_job_server_role, :app)
end
desc 'Stop the delayed_job process'
task :stop do
on roles(delayed_job_roles) do
within release_path do
with rails_env: fetch(:rails_env) do
execute :'script/delayed_job', :stop
end
end
end
end
desc 'Start the delayed_job process'
task :start do
on roles(delayed_job_roles) do
within release_path do
with rails_env: fetch(:rails_env) do
execute :'script/delayed_job', args, :start
end
end
end
end
desc 'Restart the delayed_job process'
task :restart do
on roles(delayed_job_roles) do
within release_path do
with rails_env: fetch(:rails_env) do
execute :'script/delayed_job', args, :restart
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment