File 0002-sv.c-support-optional-LSB-init-script-actions-reload.diff of Package runit

From 50376787e21a3c42fee51715f2cc28f1b51f4f41 Mon Sep 17 00:00:00 2001
From: Gerrit Pape <pape@smarden.org>
Date: Sun, 11 Oct 2009 19:55:52 +0000
Subject: [PATCH] sv.c: support optional LSB init script actions reload and try-restart

http://bugs.debian.org/545227
---
 runit-2.1.1/man/sv.8 |   14 ++++++++++++++
 runit-2.1.1/src/sv.c |    5 ++++-
 2 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/runit-2.1.1/man/sv.8 b/runit-2.1.1/man/sv.8
index b5ece60..3949c2c 100644
--- a/runit-2.1.1/man/sv.8
+++ b/runit-2.1.1/man/sv.8
@@ -111,6 +111,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 ,
@@ -182,6 +187,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/runit-2.1.1/src/sv.c b/runit-2.1.1/src/sv.c
index 7c07101..43224b5 100644
--- a/runit-2.1.1/src/sv.c
+++ b/runit-2.1.1/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"))
-- 
1.6.0.3

openSUSE Build Service is sponsored by