diff options
-rw-r--r-- | man/sv.8 | 14 | ||||
-rw-r--r-- | package/CHANGES | 2 | ||||
-rw-r--r-- | src/sv.c | 5 |
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 =✓ 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")) |