mirror of
https://github.com/mperham/sidekiq.git
synced 2022-11-09 13:52:34 -05:00
allow custom pid file for capistrano
For those out there who use different deployment configuration, This will allow for anyone to set any pid file path they want.
This commit is contained in:
parent
1577bf379b
commit
c05cdd04e6
1 changed files with 5 additions and 4 deletions
|
@ -5,24 +5,25 @@ Capistrano::Configuration.instance.load do
|
|||
after "deploy:restart", "sidekiq:restart"
|
||||
|
||||
_cset(:sidekiq_timeout) { 10 }
|
||||
_cset(:sidekiq_role) { :app }
|
||||
_cset(:sidekiq_role) { :app }
|
||||
_cset(:sidekiq_pid) { "#{current_path}/tmp/pids/sidekiq.pid" }
|
||||
|
||||
namespace :sidekiq do
|
||||
|
||||
desc "Quiet sidekiq (stop accepting new work)"
|
||||
task :quiet, :roles => lambda { fetch(:sidekiq_role) }, :on_no_matching_servers => :continue do
|
||||
run "if [ -d #{current_path} ] && [ -f #{current_path}/tmp/pids/sidekiq.pid ]; then cd #{current_path} && #{fetch(:bundle_cmd, "bundle")} exec sidekiqctl quiet #{current_path}/tmp/pids/sidekiq.pid ; fi"
|
||||
run "if [ -d #{current_path} ] && [ -f #{fetch :sidekiq_pid} ]; then cd #{current_path} && #{fetch(:bundle_cmd, "bundle")} exec sidekiqctl quiet #{fetch :sidekiq_pid} ; fi"
|
||||
end
|
||||
|
||||
desc "Stop sidekiq"
|
||||
task :stop, :roles => lambda { fetch(:sidekiq_role) }, :on_no_matching_servers => :continue do
|
||||
run "if [ -d #{current_path} ] && [ -f #{current_path}/tmp/pids/sidekiq.pid ]; then cd #{current_path} && #{fetch(:bundle_cmd, "bundle")} exec sidekiqctl stop #{current_path}/tmp/pids/sidekiq.pid #{fetch :sidekiq_timeout} ; fi"
|
||||
run "if [ -d #{current_path} ] && [ -f #{fetch :sidekiq_pid} ]; then cd #{current_path} && #{fetch(:bundle_cmd, "bundle")} exec sidekiqctl stop #{fetch :sidekiq_pid} #{fetch :sidekiq_timeout} ; fi"
|
||||
end
|
||||
|
||||
desc "Start sidekiq"
|
||||
task :start, :roles => lambda { fetch(:sidekiq_role) }, :on_no_matching_servers => :continue do
|
||||
rails_env = fetch(:rails_env, "production")
|
||||
run "cd #{current_path} ; nohup #{fetch(:bundle_cmd, "bundle")} exec sidekiq -e #{rails_env} -C #{current_path}/config/sidekiq.yml -P #{current_path}/tmp/pids/sidekiq.pid >> #{current_path}/log/sidekiq.log 2>&1 &", :pty => false
|
||||
run "cd #{current_path} ; nohup #{fetch(:bundle_cmd, "bundle")} exec sidekiq -e #{rails_env} -C #{current_path}/config/sidekiq.yml -P #{fetch :sidekiq_pid} >> #{current_path}/log/sidekiq.log 2>&1 &", :pty => false
|
||||
end
|
||||
|
||||
desc "Restart sidekiq"
|
||||
|
|
Loading…
Add table
Reference in a new issue