Skip to content

Commit

Permalink
Don't use sudo to stop workers.
Browse files Browse the repository at this point in the history
sudo isn't being used to start them, so there should be no reason to
require sudo for stopping them.
  • Loading branch information
dmarkow committed Feb 5, 2014
1 parent 1d5063c commit d5bc43b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/capistrano-resque/capistrano_integration.rb
Expand Up @@ -44,7 +44,7 @@ def start_command(queue, pid)
def stop_command
"if [ -e #{current_path}/tmp/pids/resque_work_1.pid ]; then \
for f in `ls #{current_path}/tmp/pids/resque_work*.pid`; \
do #{try_sudo} kill -s #{resque_kill_signal} `cat $f` \
do kill -s #{resque_kill_signal} `cat $f` \
&& rm $f ;done \
;fi"
end
Expand All @@ -63,7 +63,7 @@ def start_scheduler(pid)

def stop_scheduler(pid)
"if [ -e #{pid} ]; then \
#{try_sudo} kill -s #{resque_kill_signal} $(cat #{pid}) ; rm #{pid} \
kill -s #{resque_kill_signal} $(cat #{pid}) ; rm #{pid} \
;fi"
end

Expand Down
4 changes: 2 additions & 2 deletions lib/capistrano-resque/tasks/capistrano-resque.rake
Expand Up @@ -69,7 +69,7 @@ namespace :resque do
within current_path do
pids = capture(:ls, "-1 tmp/pids/resque_work*.pid")
pids.each_line do |pid_file|
sudo :kill, "-s #{fetch(:resque_kill_signal)} $(cat #{pid_file.chomp}) && rm #{pid_file.chomp}"
execute :kill, "-s #{fetch(:resque_kill_signal)} $(cat #{pid_file.chomp}) && rm #{pid_file.chomp}"
end
end
end
Expand Down Expand Up @@ -108,7 +108,7 @@ namespace :resque do
on roles :resque_scheduler do
pid = "#{current_path}/tmp/pids/scheduler.pid"
if test "[ -e #{pid} ]"
sudo :kill, "-s #{fetch(:resque_kill_signal)} $(cat #{pid}); rm #{pid}"
execute :kill, "-s #{fetch(:resque_kill_signal)} $(cat #{pid}); rm #{pid}"
end
end
end
Expand Down

0 comments on commit d5bc43b

Please sign in to comment.