From a07be0513af5181f3e2a57f9e313f4a08740c3f4 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Fri, 13 Apr 2007 09:21:16 +0000 Subject: [PATCH] s-s-d now allows --signal to be used without --stop and --oknodo. man page updated accordingly --- man/start-stop-daemon.8 | 28 ++++++++++++++++++++++++++-- src/start-stop-daemon.c | 12 ++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/man/start-stop-daemon.8 b/man/start-stop-daemon.8 index 5ec29f2e..0120395d 100644 --- a/man/start-stop-daemon.8 +++ b/man/start-stop-daemon.8 @@ -1,4 +1,4 @@ -.TH "BASELAYOUT" "8" "March 2007" "baselayout" "baselayout" +.TH "BASELAYOUT" "13" "April 2007" "baselayout" "baselayout" .SH NAME start\-stop\-daemon \- start and stop system daemon programs .SH SYNOPSIS @@ -13,6 +13,10 @@ start\-stop\-daemon \- start and stop system daemon programs .IR options .HP .B start-stop-daemon +.BR -s | --signal +.IR options +.HP +.B start-stop-daemon .BR -H | --help .HP .B start-stop-daemon @@ -62,7 +66,26 @@ exits with error status 1. If is specified then we just send the signal and not the schedule. If .BR --oknodo is specified then we don't remove the daemon information from -.BR rc. +.BR rc. If neither +.BR --test +or +.BR --okndo +are specified then we kill signalling and waiting according to our +schedule specified by +.BR --retry +until we timeout the process(es) exited. If we didn't timeout then +we remove our daemon information from rc. + +With +.BR --signal , +.B start\-stop\-daemon +also checks for the existence of a specified process. +If such a process exists, +.B start\-stop\-daemon +sends it the signal specified and exits with error status 0. +If such a process does not exist, or there was an error stopping it +.B start\-stop\-daemon +exits with error status 1. No futher action is taken .SH OPTIONS @@ -142,6 +165,7 @@ but take no action. .TP .BR -o | --oknodo Used for sending signals to a running daemon but not expecting it to stop. +In this version you can don't need --oknodo if you don't use --stop either. .TP .BR -q | --quiet Do not print informational messages; only display error messages. diff --git a/src/start-stop-daemon.c b/src/start-stop-daemon.c index ef4fac03..82270668 100644 --- a/src/start-stop-daemon.c +++ b/src/start-stop-daemon.c @@ -680,6 +680,18 @@ int main (int argc, char **argv) if (rc_is_env ("RC_QUIET", "yes") && ! verbose) quiet = true; + /* Allow start-stop-daemon --signal HUP --exec /usr/sbin/dnsmasq + * instead of forcing --stop --oknodo as well */ + if (! start && ! stop) + if (sig != SIGINT && + sig != SIGTERM && + sig != SIGQUIT && + sig != SIGKILL) + { + oknodo = true; + stop = true; + } + if (start == stop) eerrorx ("%s: need one of --start or --stop", progname);