From 8ec9708220aebf129a2ac8da41d2615cf8621b03 Mon Sep 17 00:00:00 2001 From: Elpizo Choi Date: Tue, 19 Jun 2012 17:03:15 -0700 Subject: [PATCH 1/2] don't run quiet or stop when no current_path found --- lib/sidekiq/capistrano.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/sidekiq/capistrano.rb b/lib/sidekiq/capistrano.rb index 9b8d01ed..78350f52 100644 --- a/lib/sidekiq/capistrano.rb +++ b/lib/sidekiq/capistrano.rb @@ -11,12 +11,12 @@ Capistrano::Configuration.instance.load do desc "Quiet sidekiq (stop accepting new work)" task :quiet, :roles => lambda { fetch(:sidekiq_role) }, :on_no_matching_servers => :continue do - run "cd #{current_path} && if [ -f #{current_path}/tmp/pids/sidekiq.pid ]; then #{fetch(:bundle_cmd, "bundle")} exec sidekiqctl quiet #{current_path}/tmp/pids/sidekiq.pid ; fi" + run "if [ -f #{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" end desc "Stop sidekiq" task :stop, :roles => lambda { fetch(:sidekiq_role) }, :on_no_matching_servers => :continue do - run "cd #{current_path} && if [ -f #{current_path}/tmp/pids/sidekiq.pid ]; then #{fetch(:bundle_cmd, "bundle")} exec sidekiqctl stop #{current_path}/tmp/pids/sidekiq.pid #{fetch :sidekiq_timeout} ; fi" + run "if [ -f #{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" end desc "Start sidekiq" From c43d7cffd025dde3e589a05fe118cc4119ec42e3 Mon Sep 17 00:00:00 2001 From: Elpizo Choi Date: Tue, 19 Jun 2012 17:20:57 -0700 Subject: [PATCH 2/2] fix command to use -d for directory --- lib/sidekiq/capistrano.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/sidekiq/capistrano.rb b/lib/sidekiq/capistrano.rb index 78350f52..c97996a4 100644 --- a/lib/sidekiq/capistrano.rb +++ b/lib/sidekiq/capistrano.rb @@ -11,12 +11,12 @@ Capistrano::Configuration.instance.load do desc "Quiet sidekiq (stop accepting new work)" task :quiet, :roles => lambda { fetch(:sidekiq_role) }, :on_no_matching_servers => :continue do - run "if [ -f #{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 #{current_path}/tmp/pids/sidekiq.pid ]; then cd #{current_path} && #{fetch(:bundle_cmd, "bundle")} exec sidekiqctl quiet #{current_path}/tmp/pids/sidekiq.pid ; fi" end desc "Stop sidekiq" task :stop, :roles => lambda { fetch(:sidekiq_role) }, :on_no_matching_servers => :continue do - run "if [ -f #{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 #{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" end desc "Start sidekiq"