Sha256: 65be53f269a82dca842c12d6d2c7325a3503cce41db8f01c5c7a5edbb6794aeb

Contents?: true

Size: 1.05 KB

Versions: 4

Compression:

Stored size: 1.05 KB

Contents

# Capistrano task for Resque::Forker.
#
# To use these tasks, require "resque/capistrano" at the top of the Capfile and
# associate your woker instances with the role 'worker'.
#
# Performs workers:reload after deploy:restart, workers:suspend before
# deploy:web:disable and workers:resume after deploy:web:enable.
Capistrano::Configuration.instance(:must_exist).load do
  after "deploy:restart", "workers:reload"
  before "deploy:web:disable", "workers:suspend"
  after "deploy:web:enabled", "workers:resume"

  namespace :workers do
    desc "Suspend all resque workers"
    task :suspend, :roles=>:worker do
      run "status workers | cut -d ' ' -f 4 | xargs kill -USR2"
    end
    desc "Resume all workers that have been paused"
    task :resume, :roles=>:worker do
      run "status workers | cut -d ' ' -f 4 | xargs kill -CONT"
    end
    desc "Reload all workers"
    task :reload, :roles=>:worker do
      run "reload workers"
    end
    desc "List Resque processes"
    task :pids, :roles=>:worker do
      puts capture("ps aux | grep [r]esque")
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
resque-forker-2.1.0 lib/resque/capistrano.rb
resque-forker-2.0.0 lib/resque/capistrano.rb
resque-forker-1.3.0 lib/resque/capistrano.rb
resque-forker-1.2.1 lib/resque/capistrano.rb