aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>1999-02-26 03:00:48 +0000
committerBill Nottingham <notting@redhat.com>1999-02-26 03:00:48 +0000
commitf136458d3b258b7e8dcc3b593ee216aaa71ac09f (patch)
treed14aca14c7f4d5dd222b168bd91c8c6895e66fad
parent4c70b715e7a068881cedb80a086fd90946021b69 (diff)
downloadinitscripts-f136458d3b258b7e8dcc3b593ee216aaa71ac09f.tar
initscripts-f136458d3b258b7e8dcc3b593ee216aaa71ac09f.tar.gz
initscripts-f136458d3b258b7e8dcc3b593ee216aaa71ac09f.tar.bz2
initscripts-f136458d3b258b7e8dcc3b593ee216aaa71ac09f.tar.xz
initscripts-f136458d3b258b7e8dcc3b593ee216aaa71ac09f.zip
fix killproc to be more sane
-rwxr-xr-xrc.d/init.d/functions20
1 files changed, 12 insertions, 8 deletions
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