From dd74c73772894c6988582eb4aec0fbaf6ed558d5 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Mon, 16 Mar 2015 16:05:54 +0000 Subject: - doc fixes - added -X to s6-notifywhenup --- doc/s6-notifywhenup.html | 5 ++++- doc/s6-svc.html | 8 ++++---- src/supervision/s6-notifywhenup.c | 14 ++++++++++---- src/supervision/s6-svc.c | 2 +- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/doc/s6-notifywhenup.html b/doc/s6-notifywhenup.html index ee5a99e..b958125 100644 --- a/doc/s6-notifywhenup.html +++ b/doc/s6-notifywhenup.html @@ -31,7 +31,7 @@ needed.

Interface

-     s6-notifywhenup [ -d fd ] [ -e fifodir ] [ -f ] [ -t timeout ] prog...
+     s6-notifywhenup [ -d fd ] [ -e fifodir ] [ -f ] [ -X ] [ -t timeout ] prog...
 

Notes

diff --git a/doc/s6-svc.html b/doc/s6-svc.html index 0ca3bd7..02ef8f0 100644 --- a/doc/s6-svc.html +++ b/doc/s6-svc.html @@ -27,7 +27,7 @@ knowing their PIDs, and without using horrible hacks such as .pid files.

Interface

-     s6-svc [ -D | -U ] [ -t timeout ] [ -abqhkti12pcoduxO ] servicedir
+     s6-svc [ -D | -U ] [ -T timeout ] [ -abqhkti12pcoduxO ] servicedir
 

@@ -62,8 +62,8 @@ normally never be used on a working system.

  • -O : Once at most. Do not restart the supervised process when it dies. If it is down when the command is received, do not even start it.
  • -
  • -t timeout : if the -D or --U option has been given, -t specifies a timeout +
  • -T timeout : if the -D or +-U option has been given, -T specifies a timeout (in milliseconds) after which s6-svc will exit 1 with an error message if the service still hasn't reached the desired state. By default, the timeout is 0, which means that s6-svc will block indefinitely.
  • @@ -96,7 +96,7 @@ typically the sshd server. Take down the ftpd server and block until the process is really down.

    -
     s6-svc -Uu -t 5000 /service/ftpd 
    +
     s6-svc -Uu -T 5000 /service/ftpd 

    Bring up the ftpd server and block until it has sent notification that it is ready. Exit 1 if it is still not ready after 5 seconds. diff --git a/src/supervision/s6-notifywhenup.c b/src/supervision/s6-notifywhenup.c index 98f0401..6d66fe1 100644 --- a/src/supervision/s6-notifywhenup.c +++ b/src/supervision/s6-notifywhenup.c @@ -13,7 +13,7 @@ #include #include -#define USAGE "s6-notifywhenup [ -d fd ] [ -e fifodir ] [ -f ] [ -t timeout ] prog..." +#define USAGE "s6-notifywhenup [ -d fd ] [ -e fifodir ] [ -f ] [ -X ] [ -t timeout ] prog..." #define dieusage() strerr_dieusage(100, USAGE) static int run_child (int fd, char const *fifodir, unsigned int timeout) @@ -50,17 +50,18 @@ int main (int argc, char const *const *argv, char const *const *envp) { unsigned int fd = 1 ; char const *fifodir = "event" ; - int df = 1 ; + int df = 1, fake = 0 ; unsigned int timeout = 0 ; PROG = "s6-notifywhenup" ; { subgetopt_t l = SUBGETOPT_ZERO ; for (;;) { - register int opt = subgetopt_r(argc, argv, "d:e:ft:", &l) ; + register int opt = subgetopt_r(argc, argv, "Xd:e:ft:", &l) ; if (opt == -1) break ; switch (opt) { + case 'X' : fake = 1 ; break ; case 'd' : if (!uint0_scan(l.arg, &fd)) dieusage() ; break ; case 'e' : fifodir = l.arg ; break ; case 'f' : df = 0 ; break ; @@ -87,6 +88,11 @@ int main (int argc, char const *const *argv, char const *const *envp) close(p[0]) ; if (fd_move((int)fd, p[1]) < 0) strerr_diefu1sys(111, "fd_move") ; } + if (fake) + { + write(fd, "\n", 1) ; + close(fd) ; + } pathexec_run(argv[0], argv, envp) ; - strerr_dieexec(111, argv[1]) ; + strerr_dieexec(111, argv[0]) ; } diff --git a/src/supervision/s6-svc.c b/src/supervision/s6-svc.c index d8d2b2b..e9396de 100644 --- a/src/supervision/s6-svc.c +++ b/src/supervision/s6-svc.c @@ -8,7 +8,7 @@ #include #include -#define USAGE "s6-svc [ -D | -U ] [ -t timeout ] [ -abqhkti12pcoduxO ] servicedir" +#define USAGE "s6-svc [ -D | -U ] [ -T timeout ] [ -abqhkti12pcoduxO ] servicedir" #define dieusage() strerr_dieusage(100, USAGE) #define DATASIZE 63 -- cgit v1.3.1