lib/capistrano/tasks/capistrano2.rb in capistrano-sidekiq-0.3.8 vs lib/capistrano/tasks/capistrano2.rb in capistrano-sidekiq-0.4.0
- old
+ new
@@ -57,10 +57,10 @@
logger.info 'Since JRuby doesn\'t support Process.daemon, Sidekiq will not be running as a daemon.'
else
args.push '--daemon'
end
- run "if [ -d #{current_path} ] && [ ! -f #{pid_file} ]; then cd #{current_path} ; #{fetch(:sidekiq_cmd)} #{args.compact.join(' ')} ; else echo 'Sidekiq is already running'; fi", pty: false
+ run "if [ -d #{current_path} ] && [ ! -f #{pid_file} ] || ! kill -0 `cat #{pid_file}` > /dev/null 2>&1; then cd #{current_path} ; #{fetch(:sidekiq_cmd)} #{args.compact.join(' ')} ; else echo 'Sidekiq is already running'; fi", pty: false
end
desc 'Quiet sidekiq (stop accepting new work)'
task :quiet, roles: lambda { fetch(:sidekiq_role) }, on_no_matching_servers: :continue do
for_each_process do |pid_file, idx|