Sha256: 98aea688489596a7d2883f12ddb71c73b22e445ca8da74169df1717c08ac3f78

Contents?: true

Size: 1.05 KB

Versions: 2

Compression:

Stored size: 1.05 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/../utilities')

Capistrano::Configuration.instance(true).load do
  set :delayed_script_path, "#{current_path}/script/delayed_job"
  set :delayed_job_env, 'production'
  set :delayed_job_role, :app
  set :base_ruby_path,   '/usr'

  namespace :delayed_job do
    desc "Start delayed_job process"
    task :start, :roles => delayed_job_role do
      utilities.with_role(delayed_job_role) do
        try_sudo "#{base_ruby_path}/bin/ruby #{delayed_script_path} start #{delayed_job_env}"
      end
    end

    desc "Stop delayed_job process"
    task :stop, :roles => delayed_job_role do
      utilities.with_role(delayed_job_role) do
        try_sudo "#{base_ruby_path}/bin/ruby #{delayed_script_path} stop #{delayed_job_env}"
      end
    end

    desc "Restart delayed_job process"
    task :restart, :roles => delayed_job_role do
      utilities.with_role(delayed_job_role) do
        delayed_job.stop
        sleep(4)
        try_sudo "killall -s TERM delayed_job; true"
        delayed_job.start
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cap-recipes-0.3.28 lib/cap_recipes/tasks/delayed_job/manage.rb
cap-recipes-0.3.27 lib/cap_recipes/tasks/delayed_job/manage.rb