From cd15563e5f958e551f7d9a6b77bc52c02cdd41e0 Mon Sep 17 00:00:00 2001 From: Anton Fiuman Date: Sat, 31 May 2008 22:51:27 +0200 Subject: [PATCH] Load /var/run/shutdown.omit.d/packagename files for programs that need to survive a killall5 call Used with a patched killall5 let the users/scripts specify wich program should not be killed during shutdown. Please refer to bug FS#10536. Signed-off-by: Anton Fiuman --- rc.shutdown | 16 ++++++++++++++-- 1 files changed, 14 insertions(+), 2 deletions(-) diff --git a/rc.shutdown b/rc.shutdown index 59f6e25..a9f7998 100755 --- a/rc.shutdown +++ b/rc.shutdown @@ -13,6 +13,18 @@ echo " " printhl "Initiating Shutdown..." echo " " +# Load shutdown.omit.d/packagename files for programs that need to survive a killall5 call +OMITPIDS= + +if [ -d /var/run/shutdown.omit.d/ ]; then + for pidfile in /var/run/shutdown.omit.d/*; do + [ -f "$pidfile" ] || continue + for pid in $(cat $pidfile); do + OMITPIDS="${OMITPIDS:+$OMITPIDS }-o $pid" + done + done +fi + # avoid NIS hanging syslog-ng on shutdown by unsetting the domainname if [ -x /bin/domainname ]; then /bin/domainname "" @@ -41,12 +53,12 @@ fi # Terminate all processes stat_busy "Sending SIGTERM To Processes" -/sbin/killall5 -15 &> /dev/null +/sbin/killall5 -15 $OMITPIDS &> /dev/null /bin/sleep 5 stat_done stat_busy "Sending SIGKILL To Processes" -/sbin/killall5 -9 &> /dev/null +/sbin/killall5 -9 $OMITPIDS &> /dev/null /bin/sleep 1 stat_done -- 1.5.5.3