aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--functions15
1 files changed, 13 insertions, 2 deletions
diff --git a/functions b/functions
index 6efcd52..2f10e01 100644
--- a/functions
+++ b/functions
@@ -285,14 +285,25 @@ stop_all_daemons() {
kill_all() {
# Terminate all processes
+ # and wait until killall5 reports all done or timeout
+ # Unfortunately killall5 does not support the 0 signal, so just
+ # use SIGCONT for checking (which should be ignored).
stat_busy "Sending SIGTERM To Processes"
+ local i
killall5 -15 ${omit_pids[@]/#/-o } &>/dev/null
- sleep 5
+ for (( i=0; i<20 && $?!=2; i++ )); do
+ sleep .25 # 1/4 second
+ killall5 -18 ${omit_pids[@]/#/-o } &>/dev/null
+ done
stat_done
stat_busy "Sending SIGKILL To Processes"
+ local i
killall5 -9 ${omit_pids[@]/#/-o } &>/dev/null
- sleep 1
+ for (( i=0; i<4 && $?!=2; i++ )); do
+ sleep .25 # 1/4 second
+ killall5 -18 ${omit_pids[@]/#/-o } &>/dev/null
+ done
stat_done
}