lib/rexec/daemon/controller.rb in rexec-1.6.0 vs lib/rexec/daemon/controller.rb in rexec-1.6.1
- old
+ new
@@ -186,20 +186,22 @@
pid = ProcessFile.recall(daemon)
Process.kill("INT", pid)
sleep 0.1
+ sleep 1 if ProcessFile.running(daemon)
+
# Kill/Term loop - if the daemon didn't die easily, shoot
# it a few more times.
attempts = 5
while ProcessFile.running(daemon) and attempts > 0
- sig = (attempts < 2) ? "KILL" : "TERM"
+ sig = (attempts >= 2) ? "KILL" : "TERM"
puts "Sending #{sig} to pid #{pid}...".color(:red)
Process.kill(sig, pid)
- sleep 1
attempts -= 1
+ sleep 1
end
# If after doing our best the daemon is still running (pretty odd)...
if ProcessFile.running(daemon)
puts "Daemon appears to be still running!".color(:red)