Signaling a service
Earlier, in the Start dependencies section, I showed how the sv
command-line tool can be used to control a service. Later on, I demonstrated how the sv start
and sv down
commands can be used inside run
and finish
scripts to communicate between services. You may have already guessed that runsv
is sending POSIX signals to the run
processes that it supervises when an sv
command executes. But what you may not have known is that the sv
tool controls its target runsv
process over a named pipe. The named pipes supervise/control
and optionally log/supervise/control
are opened so that other processes can send commands to runsv
. Signaling a service is easy with sv
commands, but if you want to, you can bypass sv
entirely and write control characters directly to the control
pipe(s).
The runtime directory layout of a service with no dedicated logging looks like this:
# tree /etc/sv/syslogd /etc/sv/syslogd |-- run `-- supervise |-- control ...