From f136458d3b258b7e8dcc3b593ee216aaa71ac09f Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Fri, 26 Feb 1999 03:00:48 +0000 Subject: fix killproc to be more sane --- rc.d/init.d/functions | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'rc.d/init.d/functions') diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions index 4b8f91a0..ab3e22df 100755 --- a/rc.d/init.d/functions +++ b/rc.d/init.d/functions @@ -95,19 +95,22 @@ killproc() { if [ "$pid" != "" ] ; then [ $BOOTUP = "verbose" ] && echo -n "$base " if [ "$notset" = 1 ] ; then - # TERM first, then KILL if not dead - kill -TERM $pid && success "$base shutdown" || failure "$base shutdown" - usleep 100000 - if ps h $pid >/dev/null 2>&1 ; then - sleep 1 + if ps h $pid>/dev/null 2>&1; then + # TERM first, then KILL if not dead + kill -TERM $pid && success "$base shutdown" || failure "$base shutdown" + usleep 100000 + if ps h $pid >/dev/null 2>&1 ; then + sleep 3 if ps h $pid >/dev/null 2>&1 ; then - sleep 3 kill -KILL $pid && success "$base shutdown" || failure "$base shutdown" fi - fi + fi + fi # use specified level only else - kill $killlevel $pid && success "$base shutdown" || failure "$base shutdown" + if ps h $pid >/dev/null 2>&1; then + kill $killlevel $pid && success "$base shutdown" || failure "$base shutdown" + fi fi else failure "$base shutdown" @@ -146,6 +149,7 @@ pidofproc() { { if ((prog == $11) || (("(" prog ")") == $11) || ((prog ":") == $11)) { print $2 ; exit 0 } }' $1 } + status() { # Test syntax. if [ $# = 0 ] ; then -- cgit v1.2.1