diff options
author | Bill Nottingham <notting@redhat.com> | 2011-02-28 16:31:09 -0500 |
---|---|---|
committer | Lukas Nykryn <lnykryn@redhat.com> | 2012-08-07 10:01:57 +0200 |
commit | 6e62c51f3162081cc05ef546929aa98b8448b1cb (patch) | |
tree | 056141db67b39954b68c46fcf8b133f0a799fd04 /rc.d | |
parent | e5a5cce9011f1fac8e27581ad5eb5abd36cfab82 (diff) | |
download | initscripts-6e62c51f3162081cc05ef546929aa98b8448b1cb.tar initscripts-6e62c51f3162081cc05ef546929aa98b8448b1cb.tar.gz initscripts-6e62c51f3162081cc05ef546929aa98b8448b1cb.tar.bz2 initscripts-6e62c51f3162081cc05ef546929aa98b8448b1cb.tar.xz initscripts-6e62c51f3162081cc05ef546929aa98b8448b1cb.zip |
Make killproc more granular when delay is passed. (#428029, <xjakub@fi.muni.cz>)
Diffstat (limited to 'rc.d')
-rw-r--r-- | rc.d/init.d/functions | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/rc.d/init.d/functions b/rc.d/init.d/functions index f1fff775..22ce79e5 100644 --- a/rc.d/init.d/functions +++ b/rc.d/init.d/functions @@ -269,7 +269,7 @@ daemon() { # A function to stop a program. killproc() { - local RC killlevel= base pid pid_file= delay + local RC killlevel= base pid pid_file= delay try RC=0; delay=3 # Test syntax. @@ -312,11 +312,17 @@ killproc() { # TERM first, then KILL if not dead kill -TERM $pid >/dev/null 2>&1 usleep 100000 - if checkpid $pid && sleep 1 && - checkpid $pid && sleep $delay && - checkpid $pid ; then - kill -KILL $pid >/dev/null 2>&1 - usleep 100000 + if checkpid $pid ; then + try=0 + while [ $try -lt $delay ] ; do + checkpid $pid || break + sleep 1 + let try+=1 + done + if checkpid $pid ; then + kill -KILL $pid >/dev/null 2>&1 + usleep 100000 + fi fi fi checkpid $pid |