From patchwork Thu Feb 21 19:12:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Stefan_Fr=C3=B6berg?= X-Patchwork-Id: 222405 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from hemlock.osuosl.org (hemlock.osuosl.org [140.211.166.133]) by ozlabs.org (Postfix) with ESMTP id A02AF2C0299 for ; Fri, 22 Feb 2013 06:13:26 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 447BAA003A; Thu, 21 Feb 2013 19:13:27 +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 8TJab2zd7WD9; Thu, 21 Feb 2013 19:13:25 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 06EBBA0071; Thu, 21 Feb 2013 19:13:25 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id D066E8F75B for ; Thu, 21 Feb 2013 19:13:28 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id D9AC98A9FB for ; Thu, 21 Feb 2013 19:13:20 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id grGNtgdCLWfL for ; Thu, 21 Feb 2013 19:13:18 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail.petroprogram.com (mail.petroprogram.com [194.89.34.74]) by whitealder.osuosl.org (Postfix) with ESMTPS id 6490C89565 for ; Thu, 21 Feb 2013 19:13:18 +0000 (UTC) Received: from localhost.fi (unknown [194.89.34.74]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: stefan.froberg@petroprogram.com) by mail.petroprogram.com (Postfix) with ESMTPSA id B7698422D8; Thu, 21 Feb 2013 21:04:47 +0200 (EET) From: =?UTF-8?q?Stefan=20Fr=C3=B6berg?= To: buildroot@busybox.net Date: Thu, 21 Feb 2013 21:12:43 +0200 Message-Id: <1361473963-5943-1-git-send-email-stefan.froberg@petroprogram.com> X-Mailer: git-send-email 1.7.7.6 MIME-Version: 1.0 Subject: [Buildroot] [PATCH] busybox: remove pid file after stopping daemon with start-stop-daemon applet X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 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-bounces@busybox.net Many daemons leave pid files lying around when they are stopped with start-stop-daemon applet in BusyBox. This patch will ensure that they are properly cleaned away. Signed-off-by: Stefan Fröberg --- Note: I did not make this patch but found it from old thread in BusyBox mailing list from 2006 and just fitted it against v1.19.4. So far it has been tested to work with busybox v1.19.4. .../busybox-1.19.4-start-stop-daemon-rm-pid.patch | 35 ++++++++++++++++++++ 1 files changed, 35 insertions(+), 0 deletions(-) create mode 100755 package/busybox/busybox-1.19.4-start-stop-daemon-rm-pid.patch diff --git a/package/busybox/busybox-1.19.4-start-stop-daemon-rm-pid.patch b/package/busybox/busybox-1.19.4-start-stop-daemon-rm-pid.patch new file mode 100755 index 0000000..db199a3 --- /dev/null +++ b/package/busybox/busybox-1.19.4-start-stop-daemon-rm-pid.patch @@ -0,0 +1,35 @@ +diff -Naur busybox-1.19.4.org/debianutils/Config.src busybox-1.19.4/debianutils/Config.src +--- busybox-1.19.4.org/debianutils/Config.src 2013-02-21 15:56:12.056163205 +0200 ++++ busybox-1.19.4/debianutils/Config.src 2013-02-21 15:59:21.369223915 +0200 +@@ -58,6 +58,15 @@ + termination of system-level processes, usually the ones + started during the startup of the system. + ++config FEATURE_START_STOP_DAEMON_REMOVE_PIDFILE ++ bool "Remove pidfile on stop" ++ default y ++ depends on START_STOP_DAEMON ++ help ++ If a pidfile is specified when a process is scheluded ++ to be stopped, remove the pidfile after the process ++ is successfully stopped. ++ + config FEATURE_START_STOP_DAEMON_FANCY + bool "Support additional arguments" + default y +diff -Naur busybox-1.19.4.org/debianutils/start_stop_daemon.c busybox-1.19.4/debianutils/start_stop_daemon.c +--- busybox-1.19.4.org/debianutils/start_stop_daemon.c 2013-02-21 15:56:12.056163205 +0200 ++++ busybox-1.19.4/debianutils/start_stop_daemon.c 2013-02-21 16:03:38.119855595 +0200 +@@ -353,8 +353,11 @@ + if (!QUIET && killed) { + printf("stopped %s (pid", what); + for (p = G.found_procs; p; p = p->next) +- if (p->pid) ++ if (p->pid) { + printf(" %u", (unsigned)p->pid); ++ if (ENABLE_FEATURE_START_STOP_DAEMON_REMOVE_PIDFILE) ++ unlink(pidfile); ++ } + puts(")"); + } + ret: