summary refs log tree commit diff
diff options
context:
space:
mode:
authorGerrit Pape <pape@smarden.org>2009-10-11 19:55:52 +0000
committerGerrit Pape <pape@smarden.org>2014-08-01 06:57:26 +0000
commit5e1bdbe972b5cfb3b22bbf83a0142affa199a99b (patch)
treeb99c1d2fa73a67ed7fc0504f42eed300219180b0
parent945f6cececd9b4f3dcd35bd28b468f19596939b9 (diff)
downloadrunit-5e1bdbe972b5cfb3b22bbf83a0142affa199a99b.tar.gz
runit-5e1bdbe972b5cfb3b22bbf83a0142affa199a99b.tar.xz
runit-5e1bdbe972b5cfb3b22bbf83a0142affa199a99b.zip
* sv.c: support optional LSB init script actions reload and
    try-restart.

http://bugs.debian.org/545227
-rw-r--r--man/sv.814
-rw-r--r--package/CHANGES2
-rw-r--r--src/sv.c5
3 files changed, 20 insertions, 1 deletions
diff --git a/man/sv.8 b/man/sv.8
index 7b09602..7ed9852 100644
--- 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
index 82d117c..7375039 100644
--- 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
index 06b2e41..7d3ba19 100644
--- a/src/sv.c
+++ b/src/sv.c
@@ -305,9 +305,11 @@ int main(int argc, char **argv) {
     acts ="d"; kll =1; cbk =&check; break;
   case 'T':
     acts ="tc"; kll =1; cbk =&check; break;
+  case 't':
+    if (!str_diff(action, "try-restart")) { acts ="tc"; cbk =&check; break; }
   case 'c':
     if (!str_diff(action, "check")) { act =0; acts ="C"; cbk =&check; 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 =&check; break; }
+    if (!str_diff(action, "reload")) { acts ="h"; cbk =&check; break; }
     usage();
   case 'f':
     if (!str_diff(action, "force-reload"))