in kill_server send the signal once, then wait for up to 5sec before sending lethal SIGKILL

This commit is contained in:
Premysl Hruby 2012-04-03 14:18:35 +02:00
parent 7cc17ed8ff
commit 9184f8fd00

View File

@ -46,11 +46,16 @@ proc kill_server config {
} }
# kill server and wait for the process to be totally exited # kill server and wait for the process to be totally exited
catch {exec kill $pid}
while {[is_alive $config]} { while {[is_alive $config]} {
if {[incr wait 10] % 1000 == 0} { incr wait 10
if {$wait >= 5000} {
puts "Forcing process $pid to exit..."
catch {exec kill -KILL $pid}
} elseif {$wait % 1000 == 0} {
puts "Waiting for process $pid to exit..." puts "Waiting for process $pid to exit..."
} }
catch {exec kill $pid}
after 10 after 10
} }