commit 0bc5662921d6a15a1aaed609cf1b7e32ee5a00f9
parent 3d251d7be2b0ac006e232844f32de652ec2ab63c
Author: Gerrit Pape <pape@smarden.org>
Date: Sun, 11 Oct 2009 19:55:52 +0000
* sv.c: support optional LSB init script actions reload and
try-restart.
http://bugs.debian.org/545227
Diffstat:
3 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/man/sv.8 b/man/sv.8
@@ -112,6 +112,11 @@ Same as
but wait up to 7 seconds for the service to become down.
Then report the status or timeout.
.TP
+.B reload
+Same as
+.IR hup ,
+and additionally report the status afterwards.
+.TP
.B restart
Send the commands
.IR term ,
@@ -183,6 +188,15 @@ process to terminate.
Then report the status, and on timeout send the service the
.I kill
command.
+.TP
+.B try-restart
+if the service is running, send it the
+.I term
+and
+.I cont
+commands, and wait up to 7 seconds for the service to restart.
+Then report the status or timeout.
+
.SS Additional Commands
.TP
.B check
diff --git a/package/CHANGES b/package/CHANGES
@@ -1,5 +1,7 @@
2.1.2
+ * sv.c: support optional LSB init script actions reload and
+ try-restart.
* man/sv.8: "sv exit" does not send a TERM signal to the log service
(thx Jonathan Nieder).
* fmt_ptime.c: 64 bits time_t fix for svlogd (tnx Jérémie
diff --git a/src/sv.c b/src/sv.c
@@ -305,9 +305,11 @@ int main(int argc, char **argv) {
acts ="d"; kll =1; cbk =✓ break;
case 'T':
acts ="tc"; kll =1; cbk =✓ break;
+ case 't':
+ if (!str_diff(action, "try-restart")) { acts ="tc"; cbk =✓ break; }
case 'c':
if (!str_diff(action, "check")) { act =0; acts ="C"; cbk =✓ break; }
- case 'u': case 'd': case 'o': case 't': case 'p': case 'h':
+ case 'u': case 'd': case 'o': case 'p': case 'h':
case 'a': case 'i': case 'k': case 'q': case '1': case '2':
action[1] =0; acts =action; break;
case 's':
@@ -318,6 +320,7 @@ int main(int argc, char **argv) {
act =&status; cbk =0; break;
case 'r':
if (!str_diff(action, "restart")) { acts ="tcu"; cbk =✓ break; }
+ if (!str_diff(action, "reload")) { acts ="h"; cbk =✓ break; }
usage();
case 'f':
if (!str_diff(action, "force-reload"))