Service supervision
Once we have created service directories with run
scripts under /etc/sv
and ensured that BusyBox init
starts runsvdir
, BusyBox runit
handles all the rest. That includes starting, stopping, monitoring, and restarting all the services under its control. The runsvdir
utility starts a runsv
process for each service directory and restarts a runsv
process if it terminates. Because run
scripts run their respective daemons in the foreground, runsv
expects run
to block so that when run
exits, runsv
will restart it automatically.
Service auto-restart is desirable during system startup because run
scripts can crash. This is especially true under BusyBox runit
where services start virtually simultaneously instead of one after the other. For instance, a service may fail to start when a dependent service or essential system resource (such as a GPIO or device driver) is not yet available. In the next section, I will show you how to express dependencies between services so that...