by Vincent Danen
Traditional Linux systems use SysV init for starting the system: running init scripts to start and stop services and
also to manage system runlevels and one-time startup scripts. The problem with using a SysV init system is that
services are also treated as one-time startup scripts. When init starts the system and calls a service, such as sshd, the
service will start; but if sshd dies for some reason, it will remain down until an administrator issues a service sshd
start command to restart the service.
This can be mitigated to some degree by starting services like sshd directly from /etc/inittab, similar to getties for
login. All the console logins are separate getties, and init restarts them when users log out. Running all services out
of /etc/inittab has its own shortcomings, however, as they cannot be easily stopped without rebooting.
Gerrit Pape's runit is similar to djb's daemontools and allows you to run supervised services, like daemontools, and
also allows you to replace SysV init completely if you so desire.
Some distributions provide runit, some do not. If your chosen distribution does not, runit is easy to download and
compile.
runit can still be used without replacing init and it works just fine, with minimal effort. To begin, create a script
called /sbin/runsvdir-start with the following:
#!/bin/sh
PATH=/command:/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R6
/bin