aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2009-09-30 20:54:42 +0200
committerBill Nottingham <notting@redhat.com>2009-10-21 17:36:34 -0400
commit6433f9d59a9dd7eafc5b7ba9318728cfac58fae7 (patch)
treed912b41e69b2d9cad35b52c4928408607024b0a6
parenta23c3828e092315e71ba4d5e6befc060a4f2c07a (diff)
downloadinitscripts-6433f9d59a9dd7eafc5b7ba9318728cfac58fae7.tar
initscripts-6433f9d59a9dd7eafc5b7ba9318728cfac58fae7.tar.gz
initscripts-6433f9d59a9dd7eafc5b7ba9318728cfac58fae7.tar.bz2
initscripts-6433f9d59a9dd7eafc5b7ba9318728cfac58fae7.tar.xz
initscripts-6433f9d59a9dd7eafc5b7ba9318728cfac58fae7.zip
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.
-rwxr-xr-xrc.d/init.d/halt17
1 files changed, 13 insertions, 4 deletions
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