paulgorman.org/technical

s6

s6 is an init replacement and service manager, similar to runit. The overview is good: https://skarnet.org/software/s6/overview.html

For every service/daemon controlled by s6, an sv-supervise process watches it. s6-svscan is a supervisor of supervisors — it watches a flock of s6-supervise processes. Configuration of a daemon is handled by its controlling sv-supervise process, based out of a “service directory”. All service directories controlled by s6-svscan are collected under a “scan directory”. The s6-svc command controls a sv-supervise process, and lets us signal its daemon. The s6-svscanctl command controls a set of sv-supervise processes, and start or stop entire process trees.

The scan directory is typically ‘/service/’ (or /var/svc.d/ on Alpine). The service directories might be under ‘/etc/service’ or ‘/var/service’ or ‘/etc/sv’.

Note that the “scan directory” is set as the argument to s6-svscan or (if not supplied) its current directory.

A service directory generally contains at least a run script, which may be as simple as:

#!/command/execlineb -P
fdmove -c 2 1
myservice myarg

run files are written in a shell-ish language called execline. http://skarnet.org/software/execline/ (Maybe the service scripts can be just sh scripts too?)

A service directory typically also contains a finish script.