From patchwork Tue Jul 29 14:36:54 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tremer X-Patchwork-Id: 8959 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (Client CN "mail01.haj.ipfire.org", Issuer "R11" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4brybb59Gvz3wb0 for ; Tue, 29 Jul 2025 14:36:59 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature ECDSA (secp384r1)) (Client CN "mail02.haj.ipfire.org", Issuer "E6" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4brybb4Jx1znL for ; Tue, 29 Jul 2025 14:36:59 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4brybb3bk0z334R for ; Tue, 29 Jul 2025 14:36:59 +0000 (UTC) X-Original-To: development@lists.ipfire.org Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) client-signature RSA-PSS (4096 bits)) (Client CN "mail01.haj.ipfire.org", Issuer "R11" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4brybX3pSkz2xXb for ; Tue, 29 Jul 2025 14:36:56 +0000 (UTC) Received: from michael.haj.ipfire.org (michael.haj.ipfire.org [172.28.1.242]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature ECDSA (secp384r1)) (Client CN "michael.haj.ipfire.org", Issuer "E5" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4brybX16hgzM7; Tue, 29 Jul 2025 14:36:56 +0000 (UTC) Received: by michael.haj.ipfire.org (Postfix, from userid 0) id 4brybX0JQWzTgjc; Tue, 29 Jul 2025 14:36:56 +0000 (UTC) From: Michael Tremer To: development@lists.ipfire.org Cc: Michael Tremer Subject: [PATCH] initscripts: Fix process check for processes with PID file Date: Tue, 29 Jul 2025 14:36:54 +0000 Message-ID: <20250729143654.1331503-1-michael.tremer@ipfire.org> X-Mailer: git-send-email 2.47.2 Precedence: list List-Id: List-Subscribe: , List-Unsubscribe: , List-Post: List-Help: Sender: Mail-Followup-To: MIME-Version: 1.0 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 --- src/initscripts/system/functions | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/initscripts/system/functions b/src/initscripts/system/functions index 85eb3e975..c4b7cb39e 100644 --- a/src/initscripts/system/functions +++ b/src/initscripts/system/functions @@ -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