From 6433f9d59a9dd7eafc5b7ba9318728cfac58fae7 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Wed, 30 Sep 2009 20:54:42 +0200 Subject: halt: put a wrapper around killall5 to account for retval 2 not being an error This stops us from showing [ FAILED ] when there were no processes to kill. --- rc.d/init.d/halt | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'rc.d') diff --git a/rc.d/init.d/halt b/rc.d/init.d/halt index 08263172..5276246f 100755 --- a/rc.d/init.d/halt +++ b/rc.d/init.d/halt @@ -30,12 +30,21 @@ halt_crypto() { } kill_all() { + local STRING rc + + STRING=$1 + echo -n "$STRING " + shift /sbin/killall5 "$@" rc=$? + # Retval: 0: success 1: error 2: no processes found to kill if [ "$rc" == 1 ]; then - return 1 + failure $"$STRING" + else + success $"$STRING" fi - return 0 + echo + return $rc } # See how we were called. @@ -75,11 +84,11 @@ for i in /dev/.mdadm/*.pid; do OMITARGS="$OMITARGS -o $(cat $i)" done -action $"Sending all processes the TERM signal..." kill_all -15 $OMITARGS +kill_all $"Sending all processes the TERM signal..." -15 $OMITARGS # No need to sleep and kill -9 if no processes to kill were found if [ "$?" == 0 ]; then sleep 2 - action $"Sending all processes the KILL signal..." kill_all -9 $OMITARGS + kill_all $"Sending all processes the KILL signal..." -9 $OMITARGS fi # Write to wtmp file before unmounting /var -- cgit v1.2.1