From patchwork Sun Oct 25 00:59:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Beno=C3=AEt_Th=C3=A9baudeau?= X-Patchwork-Id: 535521 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ozlabs.org (Postfix) with ESMTP id 81E4814130B for ; Sun, 25 Oct 2015 12:00:44 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=ikklswKy; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id CD892317F3; Sun, 25 Oct 2015 01:00:43 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0gy3VdXrBjqs; Sun, 25 Oct 2015 01:00:39 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 60C0E31BD4; Sun, 25 Oct 2015 01:00:13 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 683C91C0BE0 for ; Sun, 25 Oct 2015 00:59:57 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 64BF08ABDC for ; Sun, 25 Oct 2015 00:59:57 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mys2OOjVKcYc for ; Sun, 25 Oct 2015 00:59:56 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wi0-f178.google.com (mail-wi0-f178.google.com [209.85.212.178]) by hemlock.osuosl.org (Postfix) with ESMTPS id 9D7958AB94 for ; Sun, 25 Oct 2015 00:59:56 +0000 (UTC) Received: by wicfx6 with SMTP id fx6so72332565wic.1 for ; Sat, 24 Oct 2015 17:59:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=9UezpmNuLwTA8IH4GMXtwuGxzSrjc0GIMDu1JK+YHhg=; b=ikklswKyLY6SVT45h+srzHtNAgSkD10eIW4Pmscgsp9zh3vwwzKLNPeB14oWRh0AHq 6ODSVy1NGawBPZSJGmRditjxZo9IhTYu9DIuVFNS9YEga9l9IbYgYLXmqU8DaWNN/76A ZkzlKEJrY5v7dt+eYDi55Mtm7SMljp/1o41lC8/vnvpojMhjeWH2Wrb6nLHPtjBiYTuA jprWSLUFlhn4XdlSuIAitdSdU1F2MU2sqVkUspbuOYA5/KVZ5oSALg20pYJysevL1cr2 xYfPVBfPNLJiiJyGIA3mk9oz/ostp//yqjDnPHEGicNlSY/BfMI100xYL30sudhM9bbR XyvQ== X-Received: by 10.180.89.40 with SMTP id bl8mr4999604wib.69.1445734795252; Sat, 24 Oct 2015 17:59:55 -0700 (PDT) Received: from localhost.localdomain (vno44-1-88-172-188-148.fbx.proxad.net. [88.172.188.148]) by smtp.gmail.com with ESMTPSA id jd9sm8406757wic.0.2015.10.24.17.59.54 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 24 Oct 2015 17:59:54 -0700 (PDT) From: =?UTF-8?q?Beno=C3=AEt=20Th=C3=A9baudeau?= To: Date: Sun, 25 Oct 2015 02:59:35 +0200 Message-Id: <1445734779-7212-9-git-send-email-benoit.thebaudeau.dev@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1445734779-7212-1-git-send-email-benoit.thebaudeau.dev@gmail.com> References: <1445734779-7212-1-git-send-email-benoit.thebaudeau.dev@gmail.com> MIME-Version: 1.0 Cc: Thomas Petazzoni , =?UTF-8?q?Beno=C3=AEt=20Th=C3=A9baudeau?= Subject: [Buildroot] [PATCH v3 09/13] package/dhcp: SysV init scripts: remove PID files after stop X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Benoît Thébaudeau These daemons do not remove their PID files, so do it manually in the scripts. Signed-off-by: Benoît Thébaudeau --- Changes v2 -> v3: none. Changes v1 -> v2: - Rebase. --- package/dhcp/S80dhcp-relay | 12 ++++++++++-- package/dhcp/S80dhcp-server | 12 ++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/package/dhcp/S80dhcp-relay b/package/dhcp/S80dhcp-relay index 211431b..9b8d65f 100755 --- a/package/dhcp/S80dhcp-relay +++ b/package/dhcp/S80dhcp-relay @@ -17,6 +17,9 @@ OPTIONS="" CFG_FILE="/etc/default/dhcrelay" [ -r "${CFG_FILE}" ] && . "${CFG_FILE}" +# PID files generated by the daemon +PID_FILES="/var/run/dhcrelay.pid /var/run/dhcrelay6.pid" + # Sanity checks test -f /usr/sbin/dhcrelay || exit 0 test -n "$INTERFACES" || exit 0 @@ -38,8 +41,13 @@ case "$1" in ;; stop) printf "Stopping DHCP relay: " - start-stop-daemon -K -q -x /usr/sbin/dhcrelay - [ $? = 0 ] && echo "OK" || echo "FAIL" + if start-stop-daemon -K -q -x /usr/sbin/dhcrelay; then + # This daemon does not remove its PID file when it exits. + rm -f ${PID_FILES} + echo "OK" + else + echo "FAIL" + fi ;; restart | force-reload) $0 stop diff --git a/package/dhcp/S80dhcp-server b/package/dhcp/S80dhcp-server index dc9c433..1c2ff74 100755 --- a/package/dhcp/S80dhcp-server +++ b/package/dhcp/S80dhcp-server @@ -14,6 +14,9 @@ OPTIONS="" CFG_FILE="/etc/default/dhcpd" [ -r "${CFG_FILE}" ] && . "${CFG_FILE}" +# PID files generated by the daemon +PID_FILES="/var/run/dhcpd.pid /var/run/dhcpd6.pid" + # Sanity checks test -f /usr/sbin/dhcpd || exit 0 test -f /etc/dhcp/dhcpd.conf || exit 0 @@ -28,8 +31,13 @@ case "$1" in ;; stop) printf "Stopping DHCP server: " - start-stop-daemon -K -q -x /usr/sbin/dhcpd - [ $? = 0 ] && echo "OK" || echo "FAIL" + if start-stop-daemon -K -q -x /usr/sbin/dhcpd; then + # This daemon does not remove its PID file when it exits. + rm -f ${PID_FILES} + echo "OK" + else + echo "FAIL" + fi ;; restart | force-reload) $0 stop