From patchwork Fri Jan 19 16:36:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tremer X-Patchwork-Id: 7471 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 server-signature ECDSA (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4TGldH5y10z3wtq for ; Fri, 19 Jan 2024 16:37:07 +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 ECDSA (secp384r1) client-signature ECDSA (secp384r1)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4TGldG2VcszTy; Fri, 19 Jan 2024 16:37:06 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4TGldF6pYLz2xk2; Fri, 19 Jan 2024 16:37:05 +0000 (UTC) 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 ECDSA (secp384r1)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4TGldC3LLXz2xcr for ; Fri, 19 Jan 2024 16:37:03 +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 ECDSA (secp384r1) server-digest SHA384 client-signature ECDSA (secp384r1) client-digest SHA384) (Client CN "michael.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4TGldC0XKCz97; Fri, 19 Jan 2024 16:37:03 +0000 (UTC) Received: by michael.haj.ipfire.org (Postfix, from userid 0) id 4TGldB6fTTzTjCM; Fri, 19 Jan 2024 16:37:02 +0000 (UTC) From: Michael Tremer To: development@lists.ipfire.org Subject: [PATCH] network: Only try to restart collectd if it is running Date: Fri, 19 Jan 2024 16:36:58 +0000 Message-Id: <20240119163658.805656-1-michael.tremer@ipfire.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Message-ID-Hash: 3WJRCRBSDWEEHCM67CNKBI6CFDJVIYE5 X-Message-ID-Hash: 3WJRCRBSDWEEHCM67CNKBI6CFDJVIYE5 X-MailFrom: root@michael.haj.ipfire.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Michael Tremer X-Mailman-Version: 3.3.8 Precedence: list List-Id: IPFire development talk Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: This updated version of this script avoids any errors if collectd is not running (yet) which might happen during the boot process. Signed-off-by: Michael Tremer --- src/initscripts/networking/red.up/60-collectd | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/initscripts/networking/red.up/60-collectd b/src/initscripts/networking/red.up/60-collectd index 0e457894f..a96543354 100644 --- a/src/initscripts/networking/red.up/60-collectd +++ b/src/initscripts/networking/red.up/60-collectd @@ -1,6 +1,8 @@ #!/bin/bash # Restart collectd because the ping plugin does not re-resolve "gateway" -exec /etc/init.d/collectd restart +if pgrep collectd &>/dev/null; then + exec /etc/init.d/collectd restart &>/dev/null +fi -exit 1 +exit 0