2010-07-02 11:27, Thomas Bächler:
First of all, sorry for not continuing the review yesterday, time is short :(
Still, I'll finish this, as I'd like to have this applied eventually.
Am 02.07.2010 11:21, schrieb Kurt J. Bosch:
Am 2010-06-30 23:47, schrieb Victor Lowther:
Move that shared code into functions. + run_hook single_prekillall
This line should be run_hook "${0##*/rc.}"_prekillall IMHO
Kurt is right here. We call this code from rc.single and rc.shutdown I think. We use two distinct hooks, you can register functions for these hooks independently!
Hmm, git bashification-redux has now:
kill_everything() {
# $1 = where we are being called from.
# This is used to determine which hooks to run.
# Find daemons NOT in the DAEMONS array. Shut these down first
for daemon in /var/run/daemons/*; do
[[ -f $daemon ]] || continue
daemon=${daemon##*/}
in_array "$daemon" "${DAEMONS[@]}" || stop_daemon "$daemon"
done
# Shutdown daemons in reverse order
for ((i=${#DAEMONS[@]}-1; i>=0; i--)); do
[[ ${DAEMONS[$i]:0:1} = '!' ]] && continue
ck_daemon ${DAEMONS[$i]#@} || stop_daemon ${DAEMONS[$i]#@}
done
# Terminate all processes
stat_busy "Sending SIGTERM To Processes"
run_hook "$1_prekillall"
/sbin/killall5 -15 &> /dev/null
/bin/sleep 5
stat_done
stat_busy "Sending SIGKILL To Processes"
/sbin/killall5 -9 &> /dev/null
/bin/sleep 1
stat_done
run_hook "$1_postkillall"
}
I suggest:
From b202be97f8dc1c0c68aaea792d4457c674c673f3 Mon Sep 17 00:00:00 2001
From: Kurt J. Bosch