[PATCH] Allow start-stop-daemon to remove pidfiles after stopping a process
Jason Schoon
floydpink at gmail.com
Fri Aug 4 15:53:27 UTC 2006
Start-stop-daemon currently leaves pidfiles laying around after
stopping the corresponding process. This patch will remove them after
successfully killing the process.
To me, this is how it should always work, but I have wrapped it in a
config option just in case this isn't desired behavior for everyone.
Feel free to remove the config option, change the default, or wrap it
in a NITPICK depending on your own personal taste...
--- busybox/debianutils/start_stop_daemon.c 2006-08-04 10:41:29.000000000 -0500
+++ busybox/debianutils/start_stop_daemon.c.mine 2006-08-04
10:39:02.000000000 -0500
@@ -179,8 +188,11 @@
if (!quiet && killed) {
printf("stopped %s (pid", what);
for (p = found; p; p = p->next)
- if(p->pid < 0)
+ if(p->pid < 0) {
printf(" %d", -p->pid);
+ if (ENABLE_FEATURE_START_STOP_DAEMON_REMOVE_PIDFILE)
+ unlink(pidfile);
+ }
printf(").\n");
}
if (ENABLE_FEATURE_CLEAN_UP)
--- busybox/debianutils/Config.in 2006-08-04 10:41:27.000000000 -0500
+++ busybox/debianutils/Config.in.mine 2006-08-04 10:41:14.000000000 -0500
@@ -61,6 +61,14 @@
termination of system-level processes, usually the ones
started during the startup of the system.
+config CONFIG_FEATURE_START_STOP_DAEMON_REMOVE_PIDFILE
+ bool "Remove pidfile on stop"
+ default y
+ depends on CONFIG_START_STOP_DAEMON_REMOVE_PIDFILE
+ help
+ If a pidfile is specified when a process is scheduled to be stopped,
+ remove the pidfile after the process is successfully stopped.
+
config CONFIG_FEATURE_START_STOP_DAEMON_FANCY
bool "Support additional arguments"
default y
-------------- next part --------------
A non-text attachment was scrubbed...
Name: busybox_start-stop-daemon_remove_pid.patch
Type: text/x-patch
Size: 1163 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20060804/fbb798ec/attachment-0002.bin
More information about the busybox
mailing list