-
Notifications
You must be signed in to change notification settings - Fork 9
Home
So, what is runit?
From Gerrit Pape's original description:
"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."
If your OS choice is a POSIX-like OS at it's core, the odds are rather good that runit will work rather well as an init/services engine and framework for that OS.
The program runit is intended to run as POSIX/SysV process number 1; it is automatically started by the runit-init /sbin/init-replacement if this is started by the kernel of your chosen OS.
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 (This means if you have an unhandled error in your Stage 1 scripting, it will not complete it properly, bailing out to Stage 2 at the moment of the error.). The system's one time initialization tasks are done here- and generally, they're sequential, in-order. /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.
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 generally resolved automatically, but can rely on the "sv" tool to check whether a crucial service or set thereof have started to run before trying to start the service in question.
runit is optimized for reliability and small size. Process number 1 and related initial processes should be kept simple because it's easier to audit the code for proper function. Easier to audit makes it harder to have exploitable attack surfaces on the program that's at the root of all other system functionality, literally operating at a permission level "above" what we call "root" on a POSIX system.
About runit:
Benefits
Frequently Asked Questions (FAQ)
Building runit:
Setting up runit:
Replacing Init
Running WITH Init
Runlevels
Service Dependencies
Execution Modifiers
Using runit commands:
runit
runit-init
sv
runsvdir
runsvchdir
runsv
svlogd
chpst
utmpset