runit

Submitted by doug on Fri, 2007-03-02 22:16.System management

a UNIX init scheme with service supervision

smarden.org/runit/

Sat, 2002-06-01 08:00

sysvinit runlevel utmp daemontools syslog

Mature

runit is a cross-platform Unix init scheme with service supervision, a replacement for sysvinit, and other init schemes. It runs on GNU/Linux, *BSD, MacOSX, Solaris, and can easily be adapted to other Unix operating systems. runit is discussed on the <supervision@list.skarnet.org> mailing list.

To subscribe send an empty email to <supervision-subscribe@list.skarnet.org>.

Mailing list archives are available at skarnet.org, and gmane.org. The program runit is intended to run as Unix process no 1, it is automatically started by the runit-init /sbin/init-replacement if this is started by the kernel.

runit performs the system's booting, running and shutting down in three stages:

  • Stage 1: runit starts /etc/runit/1 and waits for it to terminate. The system's one time initialization tasks are done here. /etc/runit/1 has full control over /dev/console to be able to start an emergency shell in case the one time initialization tasks fail.
  • Stage 2: runit starts /etc/runit/2 which should not return until the system is going to halt or reboot; if it crashes, it will be restarted. Normally, /etc/runit/2 runs runsvdir. In Stage 2 runit optionally handles the INT signal (ctrl-alt-del keyboard request on Linux/i386).
  • Stage 3: If runit is told to halt or reboot the system, or Stage 2 returns without errors, it terminates Stage 2 if it is running, and runs /etc/runit/3. The systems tasks to shutdown and halt or reboot are done here.

These are working examples for Debian sarge: /etc/runit/1, /etc/runit/2, /etc/runit/3.

The program runit-init is intended to replace /sbin/init. The command init 0 tells runit to halt the system, and init 6 to reboot. Runlevels are handled through the runsvdir and runsvchdir programs. Service dependencies are resolved automatically.

runit is optimized for reliability and small size. The amount of code in process no 1 should be minimal.

Trackback URL for this post:

http://lopsa.org/trackback/1246