]> git.ipfire.org Git - people/stevee/ipfire-2.x.git/commitdiff
initscripts: Fix process check for processes with PID file
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 29 Jul 2025 14:36:54 +0000 (14:36 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 4 Aug 2025 15:43:45 +0000 (15:43 +0000)
This check tests whether a process is still alive, but it fails for
those processes when we are using a PID file.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/initscripts/system/functions

index 85eb3e975b348943f0c3b00e8aec7ee3df56ef2e..c4b7cb39e675519e7fff7cbc0630f95766edc6d7 100644 (file)
@@ -620,7 +620,11 @@ killproc()
        done
 
        if [ -z "${killsig}" ]; then
-               pidofproc -s "${1}"
+               if [ -z "${pidfile}" ]; then
+                       pidofproc -s "${1}"
+               else
+                       pidofproc -s -p "${pidfile}" "${1}"
+               fi
 
                # Program was terminated
                if [ "$?" != "0" ]; then