From 8b87ac94acf67ee6c66530716ba0e74498047241 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Mon, 21 Sep 2009 13:27:41 -0400 Subject: Use halt's return code to avoid unnecessary sleeping. (#524359, ) --- rc.d/init.d/halt | 7 +++++-- 1 file changed, 5 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 9d8bb152..e32188c2 100755 --- a/rc.d/init.d/halt +++ b/rc.d/init.d/halt @@ -67,8 +67,11 @@ for i in /dev/.mdadm/*.pid; do done action $"Sending all processes the TERM signal..." /sbin/killall5 -15 $OMITARGS -sleep 2 -action $"Sending all processes the KILL signal..." /sbin/killall5 -9 $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 +fi # Write to wtmp file before unmounting /var /sbin/halt -w -- cgit v1.2.1