s6
Software
skarnet.org
The s6-notifywhenup program
s6-notifywhenup launches a daemon while listening to a file descriptor,
and sends a 'U' event to a fifodir when it
receives something on that file descriptor.
This page explains why this program is
needed.
Interface
s6-notifywhenup [ -d fd ] [ -e fifodir ] [ -f ] [ -t timeout ] prog...
- s6-notifywhenup forks and executes prog... as the
parent, with a pipe from prog...'s stdout to the child.
- The child waits for a newline (\n) to be written
on the pipe. When it gets it, it creates a
./supervise/ready file then sends a 'U' event to the
./event fifodir.
- The child exits 0.
Options
- -d fd : listen to
prog's output on descriptor fd. The default is 1.
- -e fifodir : send a 'U' event to fifodir
fifodir. Default is ./event.
- -f : simple fork. Normally, s6-notifywhenup doubleforks,
in order to accommodate for a
prog that does not expect to have a child and avoid a
pending zombie. This option avoids the doublefork, but it should only be
set if prog reaps even children it doesn't know it has.
- -t timeout : if no EOF has been received
after timeout milliseconds, exit without sending the event.
Default is 0, meaning infinite.
Notes
- s6-notifywhenup executes prog... as the parent in order
for prog to keep the same pid, which is vital for supervised
processes.
- s6-notifywhenup can be used, for instance, with
s6-ipcserver
and its -1 option, so that reliable startup notification is
achieved. s6-notifywhenup -f s6-ipcserver -1 args will
send a 'U' event to ./event when s6-ipcserver is actually
listening to its socket.
- The s6-svwait program can be used
to wait for 'U' events, as well as the
s6-svlisten1 and
s6-svlisten programs.
- The supervise/ready file, when created, contains at least
the absolute time when s6-notifywhenup detected service readiness. The
format and contents of this file are subject to change.