s6
Software
skarnet.org
The s6-svwait program
s6-svwait blocks until a collection of supervised services goes up, or down.
s6-svwait only waits for notifications; it never polls.
Interface
s6-svwait [ -U | -u | -D | -d ] [ -a | -o ] [ -t timeout ] servicedir...
s6-svwait monitors one or more service
directories given as its arguments, waiting for a state (ready, up or down) to
happen. It exits 0 when the wanted condition becomes true.
Options
- -u : up. s6-svwait will wait until the services are up, as
reported by s6-supervise.
This is the default; it is not reliable, but it does not depend on specific
support in the service programs. See this page
for details.
- -U : really up. s6-svwait will wait until the services are
up and ready as reported by the services themselves. This requires
specific support in the service programs, and the use of the
notification-fd file in the
service directory.
See the explanation on this page.
- -d : down. s6-svwait will wait until the services are down.
- -D : really down. s6-svwait will wait until the
services are down and the cleanup scripts in
servicedir/finish
for every servicedir
have finished executing (or have timed out and been killed).
- -o : or. s6-svwait will wait until one of the
given services comes up or down.
- -a : and. s6-svwait will wait until all of the
given services come up or down. This is the default.
- -t timeout : if the requested events have not
happened after timeout milliseconds, s6-svwait will print a message
to stderr and exit 99. By default, timeout is 0, which means no time
limit.
Notes
- s6-svwait should be given one or more service directories as
arguments, not a scan directory. If you need to wait for a whole
scan directory, give all its contents as arguments to s6-svwait.
- s6-svwait will only work on service directories that are already
active, i.e. have a s6-supervise process
running on them. It will not work on a service directory where
s6-supervise has not been started yet.
Internals
s6-svwait spawns a s6-ftrigrd child to
listen to notifications sent by s6-supervise.
It also checks supervise/status files to get the current service
states, so it is immune to race conditions.