From f24aaac3afbc5d8caeac49387cdd73fe75e3d98e Mon Sep 17 00:00:00 2001 From: Kurt J. Bosch Date: Fri, 10 Sep 2010 20:08:59 +0200 Subject: [PATCH] Add killall5 omit pid functionality --- functions | 18 +++++++++++++++--- 1 files changed, 15 insertions(+), 3 deletions(-) diff --git a/functions b/functions index b9ba718..66e3ac7 100644 --- a/functions +++ b/functions @@ -202,6 +202,14 @@ ck_status() { fi } +# PIDs to be omitted by killall5 + +declare -a omit_pids + +add_omit_pids() { + omit_pids+=( $@ ) +} + kill_everything() { # $1 = where we are being called from. # This is used to determine which hooks to run. @@ -220,13 +228,17 @@ kill_everything() { # Terminate all processes stat_busy "Sending SIGTERM To Processes" - run_hook "$1_prekillall" - /sbin/killall5 -15 &> /dev/null + run_hook "${1}"_prekillall + local pid k5args="" + for pid in ${omit_pids[@]}; do + k5args+=" -o $pid" + done + /sbin/killall5 -15 $k5args &> /dev/null /bin/sleep 5 stat_done stat_busy "Sending SIGKILL To Processes" - /sbin/killall5 -9 &> /dev/null + /sbin/killall5 -9 $k5args &> /dev/null /bin/sleep 1 stat_done -- 1.7.0.3