]> git.pld-linux.org Git - projects/rc-scripts.git/commitdiff
killproc: improve experimental start-stop-daemon based killing.
authorElan Ruusamäe <glen@pld-linux.org>
Wed, 5 Dec 2012 20:54:15 +0000 (20:54 +0000)
committerElan Ruusamäe <glen@pld-linux.org>
Wed, 5 Dec 2012 20:54:15 +0000 (20:54 +0000)
do not send --retry, in case we specify a signal to kill (usually HUP)
as processes do not usually exit (remove their pid from pidfile) if they receive HUP

svn-id: @12603

lib/functions

index 3b9fc394e33dff0fb0287be68b2a357c2705960c..e7debacc2e3c719890f7613efbc955720a9dc5b6 100644 (file)
@@ -754,9 +754,17 @@ killproc() {
        # experimental start-stop-daemon based killing.
        # works only with pidfile
        if is_no "$RC_LOGGING" && [ "$pidfile" ]; then
-               local sig=${killlevel:--TERM}
+               local sig=${killlevel:--TERM} retry
+               # retry only if signal is not specified,
+               # as otherwise impossible to send HUP if process pid stays in pidfile.
+               if [ "${killlevel+set}" = "set" ]; then
+                       # if we send HUP it's ok if process does not die
+                       retry="--oknodo"
+               else
+                       retry="--retry ${sig#-}/10/${sig#-}/60/KILL/10"
+               fi
                /sbin/start-stop-daemon -q --stop \
-                       --retry ${sig#-}/10/${sig#-}/60/KILL/10 \
+                       $retry \
                        -s ${sig#-} \
                        ${pidfile:+--pidfile $pidfile}
                result=$?
This page took 1.072008 seconds and 4 git commands to generate.