From ed2f9c1150c240326ec4351f572787296ee2065c Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Fri, 2 Oct 2009 14:59:04 -0400 Subject: Wrap /sbin/killall5 to catch some return codes. (#526539) killall5 now returns '2' if there are no processes to kill; we don't want to treat that as 'failure'. Patch adapted from (). --- rc.d/init.d/halt | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'rc.d/init.d/halt') diff --git a/rc.d/init.d/halt b/rc.d/init.d/halt index e32188c2..08263172 100755 --- a/rc.d/init.d/halt +++ b/rc.d/init.d/halt @@ -29,6 +29,15 @@ halt_crypto() { return $fnval } +kill_all() { + /sbin/killall5 "$@" + rc=$? + if [ "$rc" == 1 ]; then + return 1 + fi + return 0 +} + # See how we were called. case "$0" in *halt) @@ -66,11 +75,11 @@ for i in /dev/.mdadm/*.pid; do OMITARGS="$OMITARGS -o $(cat $i)" done -action $"Sending all processes the TERM signal..." /sbin/killall5 -15 $OMITARGS +action $"Sending all processes the TERM signal..." kill_all -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..." /sbin/killall5 -9 $OMITARGS + action $"Sending all processes the KILL signal..." kill_all -9 $OMITARGS fi # Write to wtmp file before unmounting /var -- cgit v1.2.1