busybox: remove pid file after stopping daemon with start-stop-daemon applet
PATCH 1/1 busybox: remove pid file after stopping daemon with start-stop-daemon applet
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.
---
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
package/busybox/busybox-1.19.4-start-stop-daemon-rm-pid.patch new file +35 -0
@@ -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:
Signature · 1 line
1.7.7.6
PATCH 1/1 busybox: remove pid file after stopping daemon with start-stop-daemon applet
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Stefan" == Stefan Fr?berg <[email protected]> writes:
Stefan> Many daemons leave pid files lying around when they are stopped with Stefan> start-stop-daemon applet in BusyBox.
Stefan> This patch will ensure that they are properly cleaned away.
Stefan> Signed-off-by: Stefan Fr?berg <[email protected]> Stefan> ---
Stefan> Note: I did not make this patch but found it from old thread in BusyBox Stefan> mailing list from 2006 and just fitted it against v1.19.4. Stefan> So far it has been tested to work with busybox v1.19.4.
Sorry, we don't carry feature patches in Buildroot (certainly not for actively developed software like Busybox).
Please submit the patch to upstream busybox instead.
Signature · 1 line
Bye, Peter Korsgaard