From fc800a4c09d282bb046b67116da748d90dcfa56a Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Sun, 2 Nov 2025 07:44:29 +0000 Subject: Improve s6-svc; prepare for 2.14.0.0 --- NEWS | 4 ++- doc/index.html | 4 +-- doc/s6-svc.html | 77 +++++++++++++++++++++++++++++------------------- doc/upgrade.html | 4 +-- package/info | 2 +- src/supervision/s6-svc.c | 31 +++++++++++-------- 6 files changed, 74 insertions(+), 48 deletions(-) diff --git a/NEWS b/NEWS index 58ea619..ee8eb51 100644 --- a/NEWS +++ b/NEWS @@ -1,11 +1,13 @@ Changelog for s6. -In 2.13.3.0 +In 2.14.0.0 ----------- - Bugfixes. - Support for shared libraries on MacOS. - New Rperiod directive for s6-log periodic rotations. + - s6-svc now accepts several service directory arguments. + - s6-svc now exits 102 on unsupervised directory argument. In 2.13.2.0 diff --git a/doc/index.html b/doc/index.html index 83a345a..8d3ffa8 100644 --- a/doc/index.html +++ b/doc/index.html @@ -115,8 +115,8 @@ want nsswitch-like functionality:

Download

+

Exit codes

+ +
+
0
Success.
+
100
Usage error.
+
102
One of the arguments in servicedirs is not a +currently supervised service directory.
+
111
System call failure. +
+

Usage examples

-
 s6-svc -h /service/httpd 
+
 s6-svc -h /run/service/httpd 

- Send a SIGHUP to the process represented by the /service/httpd + Send a SIGHUP to the process represented by the /run/service/httpd service directory. Traditionally, this makes web servers reload their configuration file.

-
 s6-svc -r /service/sshd 
+
 s6-svc -r /run/service/sshd /run/service/httpd 

Kill (and automatically restart, if the wanted state of the service is up) -the process represented by the /service/sshd service directory - -typically the sshd server. +the process represented by the /run/service/sshd service directory +— typically the sshd server — as well as the process represented +by the /run/service/httpd directory — typically the Web server.

-
 s6-svc -wD -d /service/ftpd 
+
 s6-svc -wD -d /run/service/ftpd 

Take down the ftpd server and block until the process is down and the finish script has completed.

-
 s6-svc -wU -T 5000 -u /service/ftpd 
+
 s6-svc -wU -T 5000 -u /run/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.

-
 s6-svc -wR -t /service/ftpd 
+
 s6-svc -twR /run/service/ftpd /run/service/gitd 

- Send a SIGTERM to the ftpd server; wait for -s6-supervise to restart it, and block -until it has notified that it is ready to serve again. See the NOTES -section below for a caveat. + Send a SIGTERM to the ftpd server and the git server; wait for their +respective supervisors to restart them, and block +until they both have notified that they are ready to serve again. See the NOTES +section below.

-
 s6-svc -a /service/httpd/log 
+
 s6-svc -a /run/service/httpd/log 

Send a SIGALRM to the logger process for the httpd server. If this logger process is s6-log, this triggers a log rotation. @@ -169,32 +185,33 @@ process is s6-log, this triggers a log rotation.

Internals

Notes

diff --git a/doc/upgrade.html b/doc/upgrade.html index 5aa07d1..5108256 100644 --- a/doc/upgrade.html +++ b/doc/upgrade.html @@ -18,7 +18,7 @@

What has changed in s6

-

in 2.13.3.0

+

in 2.14.0.0

in 2.13.2.0

diff --git a/package/info b/package/info index 7a046ff..31f9e23 100644 --- a/package/info +++ b/package/info @@ -1,4 +1,4 @@ package=s6 -version=2.13.3.0 +version=2.14.0.0 category=admin package_macro_name=S6 diff --git a/src/supervision/s6-svc.c b/src/supervision/s6-svc.c index 40a2cd8..0c67dee 100644 --- a/src/supervision/s6-svc.c +++ b/src/supervision/s6-svc.c @@ -18,7 +18,7 @@ #include #include -#define USAGE "s6-svc [ -wu | -wU | -wd | -wD | -wr | -wR ] [ -T timeout ] [ -s signal | -abqhkti12pcyrPCK ] [ -oduDUxOQ ] servicedir" +#define USAGE "s6-svc [ -wu | -wU | -wd | -wD | -wr | -wR ] [ -T timeout ] [ -s signal | -abqhkti12pcyrPCK ] [ -oduDUxOQ ] servicedirs..." #define dieusage() strerr_dieusage(100, USAGE) #define DATASIZE 63 @@ -103,7 +103,6 @@ int main (int argc, char const *const *argv) argc -= l.ind ; argv += l.ind ; } if (!argc) dieusage() ; - if (argc > 1) strerr_warnw1x("ignoring extra arguments") ; len = strlen(argv[0]) ; if (!len) strerr_dief1x(100, "invalid service path") ; @@ -122,10 +121,10 @@ int main (int argc, char const *const *argv) if (updown[1]) { - char const *newargv[11] ; + char const *newargv[6 + argc + (datalen > 1 ? 4 + argc : 0)] ; unsigned int m = 0 ; char fmt[UINT_FMT] ; - newargv[m++] = datalen > 1 ? S6_BINPREFIX "s6-svlisten1" : S6_BINPREFIX "s6-svwait" ; + newargv[m++] = datalen > 1 ? S6_BINPREFIX "s6-svlisten" : S6_BINPREFIX "s6-svwait" ; newargv[m++] = updown ; if (timeout) { @@ -134,22 +133,30 @@ int main (int argc, char const *const *argv) newargv[m++] = fmt ; } newargv[m++] = "--" ; - newargv[m++] = argv[0] ; + for (unsigned int i = 0 ; i < argc ; i++) newargv[m++] = argv[i] ; if (datalen > 1) { + newargv[m++] = "" ; newargv[m++] = S6_BINPREFIX "s6-svc" ; newargv[m++] = data ; newargv[m++] = "--" ; - newargv[m++] = argv[0] ; + for (unsigned int i = 0 ; i < argc ; i++) newargv[m++] = argv[i] ; } newargv[m++] = 0 ; - xexec(newargv) ; + xmexec_n(newargv, "EXECLINE_STRICT", sizeof("EXECLINE_STRICT"), 1) ; } - else switch (s6_svc_writectl(argv[0], S6_SUPERVISE_CTLDIR, data + 1, datalen - 1)) + else { - case -1 : strerr_diefu2sys(111, "control ", argv[0]) ; - case -2 : strerr_dief3sys(100, "something is wrong with the ", argv[0], "/" S6_SUPERVISE_CTLDIR " directory") ; - case 0 : strerr_diefu3x(100, "control ", argv[0], ": supervisor not listening") ; + int e = 0 ; + for (unsigned int i = 0 ; i < argc ; i++) + { + switch (s6_svc_writectl(argv[0], S6_SUPERVISE_CTLDIR, data + 1, datalen - 1)) + { + case -1 : { strerr_warnwu2sys("control ", argv[i]) ; e = 111 ; break ; } + case -2 : { strerr_warnw3sys("something is wrong with the ", argv[i], "/" S6_SUPERVISE_CTLDIR " directory") ; e = 1 ; break ; } + case 0 : { strerr_warnwu3x("control ", argv[i], ": supervisor not listening") ; e = 102 ; break ; } + } + } + _exit(e) ; } - return 0 ; } -- cgit v1.3.1