Runit is an init system replacement with service supervision. Although it is not usable out of the box, it can be easily managed to do so.

Overview

Runit starts as a nuber one process. After that it runs /etc/runit/1, 2 and 3 initialisation scripts, also called "stages". You can redefine them. Stage 1 is meant for essential startup tasks, which are handled by old initscripts. Stage 2 is for normal boot process It calls runsv(8) on /service directory, where runit services are located. A runit service looks like a directory with two executable scripts: run and finish. There is also a supervision directory, where PID files and logs are located. Yes, you do not have to use syslogd. A valid runit run script should execute a daemon; the daemon being executed should stay in foreground. If that daemon exits, it will be restarted by runit. A finish script is not necessary, however you can define it.

How to make it simply work

Install it.

# apt-get install runit
mkdir /etc/runit
cp -rf /usr/share/doc/runit/debian/* /etc/runit/*
mkdir /service
ln -s /etc/sv/getty-5/ /service/getty-5

After youll boot with runit as PID 1 (you should add init=/sbin/runit-init to your kernel command line) youll have a getty at tty5. To add a runit entry to the GRUB menu, add /sbin/runit-init to the /etc/grub.d/10_linux file under the SUPPORTED_INITS string. You can add more initscripts into your /service directory. Gerrit Pape has a collection of these at http://smarden.org/runit/runscripts.html My pick is acpid,cups,dbus and slim.

If you need a run-once service and it is a dependency, you can try this: touch <service>/down an then call runsv o <service> from another init script

While using runit, you can`t shut down your system using shutdown(8) or telinit. That`s because runit does not listen to /run/initctl. You can use runit-init 0 or runit-init 6 for that. Here`s a small workaround for listening /run/initctl and calling runit for shutting down: http://pastebin.ca/3042417 To make it work, compile it with inireq.h file from original sysvinit sources and wrap it in a runit initscript.

See also

* Runit`s docs.


CategoryBootProcess