summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2015-08-27 17:12:13 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2015-08-27 17:12:13 +0000
commit5f247199e897e2d79d1a31bfb53e2fdc943a4bde (patch)
tree1201fdfbb2db6962ee63b11c561ba1157d1f9fac
parent62b08ed24bd50737ce090f9ab37acb832845ef4f (diff)
downloads6-5f247199e897e2d79d1a31bfb53e2fdc943a4bde.tar.xz
- New -wr | -wR options to s6-svc, s6-svlisten1 and s6-svlisten
- skalibs and execline dep bump - rc for 2.2.1.0 unless more new functionality is needed for s6-rc
-rw-r--r--INSTALL4
-rw-r--r--doc/index.html6
-rw-r--r--doc/s6-svc.html14
-rw-r--r--doc/s6-svlisten.html11
-rw-r--r--doc/s6-svlisten1.html7
-rw-r--r--doc/upgrade.html11
-rw-r--r--package/info2
-rw-r--r--src/supervision/s6-svc.c10
-rw-r--r--src/supervision/s6-svlisten.c19
-rw-r--r--src/supervision/s6-svlisten1.c14
10 files changed, 77 insertions, 21 deletions
diff --git a/INSTALL b/INSTALL
index 1592549..96cbb33 100644
--- a/INSTALL
+++ b/INSTALL
@@ -6,8 +6,8 @@ Build Instructions
- A POSIX-compliant C development environment
- GNU make version 4.0 or later
- - skalibs version 2.3.6.1 or later: http://skarnet.org/software/skalibs/
- - execline version 2.1.3.1 or later: http://skarnet.org/software/execline/
+ - skalibs version 2.3.7.0 or later: http://skarnet.org/software/skalibs/
+ - execline version 2.1.4.0 or later: http://skarnet.org/software/execline/
This software will run on any operating system that implements
POSIX.1-2008, available at:
diff --git a/doc/index.html b/doc/index.html
index 500d450..b458c92 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -84,11 +84,11 @@ with s6</a> </li>
<li> GNU make, version 4.0 or later. Please be aware that s6 will not build
with an earlier version. </li>
<li> <a href="http://skarnet.org/software/skalibs/">skalibs</a> version
-2.3.6.1 or later. It's a build-time requirement. It's also a run-time
+2.3.7.0 or later. It's a build-time requirement. It's also a run-time
requirement if you link against the shared version of the skalibs
library. </li>
<li> <a href="http://skarnet.org/software/execline/">execline</a> version
-2.1.3.1 or later. It's a build-time and run-time requirement. </li>
+2.1.4.0 or later. It's a build-time and run-time requirement. </li>
</ul>
<h3> Licensing </h3>
@@ -101,7 +101,7 @@ library. </li>
<h3> Download </h3>
<ul>
- <li> The current released version of s6 is <a href="s6-2.2.0.1.tar.gz">2.2.0.1</a>. </li>
+ <li> The current released version of s6 is <a href="s6-2.2.1.0.tar.gz">2.2.1.0</a>. </li>
<li> Alternatively, you can checkout a copy of the s6 git repository:
<pre> git clone git://git.skarnet.org/s6 </pre> </li>
<li> There's also a
diff --git a/doc/s6-svc.html b/doc/s6-svc.html
index 86e6857..7c3b2bd 100644
--- a/doc/s6-svc.html
+++ b/doc/s6-svc.html
@@ -28,7 +28,7 @@ knowing their PIDs, and without using horrible hacks such as .pid files.
<h2> Interface </h2>
<pre>
- s6-svc [ -wu | -wU | -wd | -wD ] [ -T <em>timeout</em> ] [ -abqhkti12pcoduxO ] <em>servicedir</em>
+ s6-svc [ -wu | -wU | -wd | -wD | -wr | -wR ] [ -T <em>timeout</em> ] [ -abqhkti12pcoduxO ] <em>servicedir</em>
</pre>
<p>
@@ -89,6 +89,11 @@ a <tt>notification-fd</tt> file to tell
<a href="s6-supervise.html">s6-supervise</a> to accept readiness
notification, s6-svc will print a warning and act as if the <tt>-wu</tt>
option had been given instead. </li>
+ <li> <tt>-wr</tt>&nbsp;: s6-svc will not exit until the service has been
+started or restarted. </li>
+ <li> <tt>-wR</tt>&nbsp;: s6-svc will not exit until the service has been
+started or restarted and has notified readiness. </li>
+
</ul>
<h2> Usage examples </h2>
@@ -119,6 +124,13 @@ the finish script has completed.
is ready. Exit 1 if it is still not ready after 5 seconds.
</p>
+<pre> s6-svc -wR -t /service/ftpd </pre>
+<p>
+ Send a SIGTERM to the ftpd server; wait for
+<a href="s6-supervise.html">s6-supervise</a> to restart it, and block
+until it has notified that it is ready to serve again.
+</p>
+
<pre> s6-svc -a /service/httpd/log </pre>
<p>
Send a SIGALRM to the logger process for the httpd server. If this logger
diff --git a/doc/s6-svlisten.html b/doc/s6-svlisten.html
index 1db24c0..2426fc9 100644
--- a/doc/s6-svlisten.html
+++ b/doc/s6-svlisten.html
@@ -34,7 +34,7 @@ a collection of supervised services, and blocks until they all go up, or down.
</p>
<pre>
- s6-svlisten [ -U | -u | -D | -d ] [ -a | -o ] [ -t <em>timeout</em> ] { <em>servicedir</em> <em>servicedir...</em> } <em>prog...</em>
+ s6-svlisten [ -U | -u | -D | -d | -r | -R ] [ -a | -o ] [ -t <em>timeout</em> ] { <em>servicedir</em> <em>servicedir...</em> } <em>prog...</em>
</pre>
<p>
@@ -42,7 +42,7 @@ a collection of supervised services, and blocks until they all go up, or down.
</p>
<pre>
- s6-svlisten [ -U | -u | -D | -d ] [ -a | -o ] [ -t <em>timeout</em> ] <em>servicedir</em> <em>servicedir...</em> "" <em>prog...</em>
+ s6-svlisten [ -U | -u | -D | -d | -r | -R ] [ -a | -o ] [ -t <em>timeout</em> ] <em>servicedir</em> <em>servicedir...</em> "" <em>prog...</em>
</pre>
<ul>
@@ -73,6 +73,11 @@ See the explanation on <a href="notifywhenup.html">this page</a>. </li>
services are down and the cleanup scripts in <tt><em>servicedir</em>/finish</tt>
for every <em>servicedir</em>
have finished executing (or have timed out and been killed). </li>
+ <li> <tt>-r</tt>&nbsp;: restart. s6-svlisten will wait until all
+the services have been started or restarted. </li>
+ <li> <tt>-R</tt>&nbsp;: restart and ready. s6-svlisten will wait until
+all the services have been started or restarted and have notified
+readiness. </li>
<li> <tt>-o</tt>&nbsp;: or. s6-svlisten will wait until <em>one</em> of the
given services comes up or down. </li>
<li> <tt>-a</tt>&nbsp;: and. s6-svlisten will wait until <em>all</em> of the
@@ -100,6 +105,8 @@ to only use it in execline scripts (only the execline syntax is guaranteed
not to change). There is a variant of s6-svlisten that does not use execline
syntax, but only handles one service directory:
<a href="s6-svlisten1.html">s6-svlisten1</a>. </li>
+ <li> The <tt>-R</tt> or <tt>-r</tt> options imply the <tt>-a</tt> option.
+It is not possible to wait for one of the listed services to restart. </li>
</ul>
</body>
diff --git a/doc/s6-svlisten1.html b/doc/s6-svlisten1.html
index c3f5ef4..0ce283f 100644
--- a/doc/s6-svlisten1.html
+++ b/doc/s6-svlisten1.html
@@ -30,7 +30,7 @@ supervised service, and blocks until said service goes up, or down.
<h2> Interface </h2>
<pre>
- s6-svlisten [ -U | -u | -D | -d ] [ -t <em>timeout</em> ] <em>servicedir</em> <em>prog...</em>
+ s6-svlisten1 [ -U | -u | -D | -d | -r | -R ] [ -t <em>timeout</em> ] <em>servicedir</em> <em>prog...</em>
</pre>
<ul>
@@ -60,6 +60,11 @@ See the explanation on <a href="notifywhenup.html">this page</a>. </li>
<li> <tt>-D</tt>&nbsp;: really down. s6-svlisten1 will wait until the
service is down and the cleanup script in <tt><em>servicedir</em>/finish</tt>
has finished executing (or has timed out and been killed). </li>
+ <li> <tt>-r</tt>&nbsp;: restart. s6-svlisteni1 will wait until
+the service has been started or restarted. </li>
+ <li> <tt>-R</tt>&nbsp;: restart and ready. s6-svlisten1 will wait until
+the service has been started or restarted and has notified
+readiness. </li>
<li> <tt>-t&nbsp;<em>timeout</em></tt>&nbsp;: if the requested event has not
happened after <em>timeout</em> milliseconds, s6-svlisten1 will print a message
to stderr and exit 1. By default, <em>timeout</em> is 0, which means no time
diff --git a/doc/upgrade.html b/doc/upgrade.html
index f74d7fb..d9d8cdd 100644
--- a/doc/upgrade.html
+++ b/doc/upgrade.html
@@ -18,6 +18,17 @@
<h1> What has changed in s6 </h1>
+<h2> in 2.2.1.0 </h2>
+
+<ul>
+ <li> skalibs dependency bumped to 2.3.7.0. </li>
+ <li> execline dependency bumped to 2.1.4.0. </li>
+ <li> <a href="s6-svc.html">s6-svc</a>,
+<a href="s6-svlisten1.html">s6-svlisten1</a> and
+<a href="s6-svlisten.html">s6-svlisten</a> support new
+<tt>-wr</tt> and <tt>-wR</tt> options. </li>
+</ul>
+
<h2> in 2.2.0.1 </h2>
<ul>
diff --git a/package/info b/package/info
index 82bde71..ce5b5e9 100644
--- a/package/info
+++ b/package/info
@@ -1,4 +1,4 @@
package=s6
-version=2.2.0.1
+version=2.2.1.0
category=admin
package_macro_name=S6
diff --git a/src/supervision/s6-svc.c b/src/supervision/s6-svc.c
index 308075d..467c174 100644
--- a/src/supervision/s6-svc.c
+++ b/src/supervision/s6-svc.c
@@ -10,7 +10,7 @@
#include <s6/config.h>
#include <s6/s6-supervise.h>
-#define USAGE "s6-svc [ -wu | -wU | -wd | -wD ] [ -T timeout ] [ -abqhkti12pcoduxOX ] servicedir"
+#define USAGE "s6-svc [ -wu | -wU | -wd | -wD | -wr | -wR ] [ -T timeout ] [ -abqhkti12pcoduxOX ] servicedir"
#define dieusage() strerr_dieusage(100, USAGE)
#define DATASIZE 63
@@ -55,7 +55,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
case 'T' : if (!uint0_scan(l.arg, &timeout)) dieusage() ; break ;
case 'w' :
{
- if (byte_chr("dDuU", 4, l.arg[0]) >= 4) dieusage() ;
+ if (byte_chr("dDuUrR", 6, l.arg[0]) >= 6) dieusage() ;
updown[1] = l.arg[0] ;
break ;
}
@@ -68,7 +68,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
if (argc > 1) strerr_warn1x("ignoring extra arguments") ;
if (datalen <= 1) return 0 ;
- if (updown[1] == 'U')
+ if (updown[1] == 'U' || updown[1] == 'R')
{
unsigned int arglen = str_len(argv[0]) ;
char fn[arglen + 17] ;
@@ -77,8 +77,8 @@ int main (int argc, char const *const *argv, char const *const *envp)
if (access(fn, F_OK) < 0)
{
if (errno != ENOENT) strerr_diefu2sys(111, "access ", fn) ;
- updown[1] = 'u' ;
- strerr_warnw2x(fn, " not present - converting -wU to -wu") ;
+ updown[1] = updown[1] == 'U' ? 'u' : 'r' ;
+ strerr_warnw2x(fn, " not present - ignoring request for readiness notification") ;
}
}
diff --git a/src/supervision/s6-svlisten.c b/src/supervision/s6-svlisten.c
index 1241d72..e53fa76 100644
--- a/src/supervision/s6-svlisten.c
+++ b/src/supervision/s6-svlisten.c
@@ -11,7 +11,7 @@
#include <execline/execline.h>
#include "s6-svlisten.h"
-#define USAGE "s6-svlisten [ -U | -u | -d | -D ] [ -a | -o ] [ -t timeout ] servicedir... \"\" prog..."
+#define USAGE "s6-svlisten [ -U | -u | -d | -D | -r | -R ] [ -a | -o ] [ -t timeout ] servicedir... \"\" prog..."
#define dieusage() strerr_dieusage(100, USAGE)
int main (int argc, char const **argv, char const *const *envp)
@@ -20,14 +20,14 @@ int main (int argc, char const **argv, char const *const *envp)
int spfd ;
int argc1 ;
int or = 0 ;
- int wantup = 1, wantready = 0 ;
+ int wantup = 1, wantready = 0, wantrestart = 0 ;
PROG = "s6-svlisten" ;
{
subgetopt_t l = SUBGETOPT_ZERO ;
unsigned int t = 0 ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "uUdDaot:", &l) ;
+ register int opt = subgetopt_r(argc, argv, "uUdDrRaot:", &l) ;
if (opt == -1) break ;
switch (opt)
{
@@ -35,6 +35,8 @@ int main (int argc, char const **argv, char const *const *envp)
case 'U' : wantup = 1 ; wantready = 1 ; break ;
case 'd' : wantup = 0 ; wantready = 0 ; break ;
case 'D' : wantup = 0 ; wantready = 1 ; break ;
+ case 'r' : wantrestart = 1 ; wantready = 0 ; break ;
+ case 'R' : wantrestart = 1 ; wantready = 1 ; break ;
case 'a' : or = 0 ; break ;
case 'o' : or = 1 ; break ;
case 't' : if (!uint0_scan(l.arg, &t)) dieusage() ; break ;
@@ -49,6 +51,11 @@ int main (int argc, char const **argv, char const *const *envp)
argc1 = el_semicolon(argv) ;
if (!argc1 || argc == argc1 + 1) dieusage() ;
if (argc1 >= argc) strerr_dief1x(100, "unterminated servicedir block") ;
+ if (wantrestart && or)
+ {
+ or = 0 ;
+ strerr_warnw3x("-o is unsupported when combined with -", wantready ? "R" : "r", "- using -a instead") ;
+ }
tain_now_g() ;
tain_add_g(&deadline, &tto) ;
@@ -63,6 +70,12 @@ int main (int argc, char const **argv, char const *const *envp)
s6_svlisten_init(argc1, argv, &foo, ids, upstate, readystate, &deadline) ;
pid = child_spawn0(argv[argc1 + 1], argv + argc1 + 1, envp) ;
if (!pid) strerr_diefu2sys(111, "spawn ", argv[argc1 + 1]) ;
+ if (wantrestart)
+ {
+ argc1 = s6_svlisten_loop(&foo, 0, 1, or, &deadline, spfd, &s6_svlisten_signal_handler) ;
+ if (argc1) return argc1 ;
+ wantup = 1 ;
+ }
return s6_svlisten_loop(&foo, wantup, wantready, or, &deadline, spfd, &s6_svlisten_signal_handler) ;
}
}
diff --git a/src/supervision/s6-svlisten1.c b/src/supervision/s6-svlisten1.c
index 32fef1f..6c4bb36 100644
--- a/src/supervision/s6-svlisten1.c
+++ b/src/supervision/s6-svlisten1.c
@@ -9,7 +9,7 @@
#include <skalibs/djbunix.h>
#include "s6-svlisten.h"
-#define USAGE "s6-svlisten1 [ -U | -u | -d | -D ] [ -t timeout ] servicedir prog..."
+#define USAGE "s6-svlisten1 [ -U | -u | -d | -D | -r | -R ] [ -t timeout ] servicedir prog..."
#define dieusage() strerr_dieusage(100, USAGE)
int main (int argc, char const *const *argv, char const *const *envp)
@@ -18,7 +18,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
tain_t deadline, tto ;
pid_t pid ;
int spfd ;
- int wantup = 1, wantready = 0 ;
+ int wantup = 1, wantready = 0, wantrestart = 0 ;
uint16 id ;
unsigned char upstate, readystate ;
PROG = "s6-svlisten1" ;
@@ -27,7 +27,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
unsigned int t = 0 ;
for (;;)
{
- register int opt = subgetopt_r(argc, argv, "uUdDt:", &l) ;
+ register int opt = subgetopt_r(argc, argv, "uUdDrRt:", &l) ;
if (opt == -1) break ;
switch (opt)
{
@@ -35,6 +35,8 @@ int main (int argc, char const *const *argv, char const *const *envp)
case 'U' : wantup = 1 ; wantready = 1 ; break ;
case 'd' : wantup = 0 ; wantready = 0 ; break ;
case 'D' : wantup = 0 ; wantready = 1 ; break ;
+ case 'r' : wantrestart = 1 ; wantready = 0 ; break ;
+ case 'R' : wantrestart = 1 ; wantready = 1 ; break ;
case 't' : if (!uint0_scan(l.arg, &t)) dieusage() ; break ;
default : dieusage() ;
}
@@ -49,5 +51,11 @@ int main (int argc, char const *const *argv, char const *const *envp)
s6_svlisten_init(1, argv, &foo, &id, &upstate, &readystate, &deadline) ;
pid = child_spawn0(argv[1], argv + 1, envp) ;
if (!pid) strerr_diefu2sys(111, "spawn ", argv[1]) ;
+ if (wantrestart)
+ {
+ register int r = s6_svlisten_loop(&foo, 0, 1, 1, &deadline, spfd, &s6_svlisten_signal_handler) ;
+ if (r) return r ;
+ wantup = 1 ;
+ }
return s6_svlisten_loop(&foo, wantup, wantready, 1, &deadline, spfd, &s6_svlisten_signal_handler) ;
}