Runlevels
Dependencies
A collection of run scripts
The runit program
The runit-init program
The runsvdir program
The runsv program
The runsvchdir program
The utmpset program
The svwaitdown program
The svwaitup program
The runsvstat program
(not installed by default)
The runsvctrl program
(not installed by default)
Warning: Replacing sysvinit or init can cause the system's boot to fail. Make sure you are able to recover and repair your system, for example if you run a boot loader, it should be able to pass init=/bin/sh to the kernel.
runit performs the system's booting, running and shutting down in three stages:
The command runit-init is intended to replace /sbin/init. sysvinit's command shutdown will keep working. On *BSD systems use init 0 for system halt and init 6 for reboot. Runlevels are handled through the runsvdir and runsvchdir programs. Service dependencies are rudimentarily handled through the svwaitup and svwaitdown programs, see Dependencies and runlevels for an example.
runit is optimized for reliability and small size. The amount of code in process no 1 should be minimal.
# strings /proc/1/exe |grep Id $Id: index.html,v 1.20 2002/10/23 09:47:49 pape Exp $ # uptime 11:32:18 up 25 days, 18:29, 2 users, load average: 0.12, 0.03, 0.01 # ps axuw |head -n14 USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.0 0.0 20 20 ? S Sep27 0:06 runit root 2 0.0 0.0 0 0 ? SW Sep27 0:00 [kflushd] root 3 0.0 0.0 0 0 ? SW Sep27 0:00 [kupdate] root 4 0.0 0.0 0 0 ? SW Sep27 0:04 [kswapd] root 5 0.0 0.0 0 0 ? SW Sep27 0:00 [keventd] root 153 0.0 1.0 1652 676 ? S Sep27 0:00 /usr/sbin/cron root 156 0.0 0.0 40 28 ? S Sep27 0:00 runsvdir /service log: ....................................................... root 157 0.0 0.0 24 24 ? S Sep27 0:00 runsv socklog-unix root 158 0.0 0.0 24 24 ? S Sep27 0:00 runsv qmail-smtpd root 159 0.0 0.0 24 24 ? S Sep27 0:00 runsv qmail-send root 160 0.0 0.0 24 24 ? S Sep27 0:00 runsv sshd root 161 0.0 0.0 24 24 ? S Sep27 0:00 runsv getty-tty2 root 162 0.0 0.0 24 24 ? S Sep27 0:00 runsv getty-tty3 # pstree runit-+-cron |-keventd |-kflushd |-kswapd |-kupdate `-runsvdir-+-2*[runsv-+-multilog] | `-socklog] |-5*[runsv-+-multilog] | `-tcpserver] |-runsv-+-multilog | `-qmail-send-+-qmail-clean | |-qmail-lspawn | `-qmail-rspawn |-runsv-+-multilog | `-sshd-+-sshd---sshd---bash---bash---ssh | `-sshd---sshd---bash---bash---pstree |-3*[runsv---getty] |-runsv---uncat |-runsv-+-dhcpd-2.2.x | `-multilog |-runsv-+-dnscache | `-multilog |-runsv-+-multilog | `-tinydns |-runsv-+-isdnlog | `-multilog |-runsv---klogd |-runsv---multilog |-2*[runsv-+-multilog] | `-vboxgetty] |-runsv---clockspeed |-runsv-+-dhclient-2.2.x | `-multilog `-runsv---squid---unlinkdThis is a more busy system:
# strings /proc/1/exe |grep Id $Id: runit.c,v 1.6 2002/01/29 18:56:36 pape Exp $ # uptime 15:04:34 up 201 days, 15:34, 3 users, load average: 0.08, 0.03, 0.01 # ps axuw |head USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.0 0.0 24 0 ? SW Feb07 0:05 runit root 2 0.0 0.0 0 0 ? SW Feb07 0:01 [keventd] root 3 0.0 0.0 0 0 ? SW Feb07 1:45 [kapm-idled] root 4 0.0 0.0 0 0 ? SWN Feb07 1:21 [ksoftirqd_CPU0] root 5 0.0 0.0 0 0 ? SW Feb07 31:40 [kswapd] root 6 0.0 0.0 0 0 ? SW Feb07 0:06 [bdflush] root 7 0.0 0.0 0 0 ? SW Feb07 14:26 [kupdated] root 53 0.0 0.0 0 0 ? SW Feb07 0:00 [msp3410 [auto]] daemon 115 0.0 0.0 1412 0 ? SW Feb07 0:00 /sbin/portmap
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.0 0.0 24 20 ? S Nov22 0:01 runitI recommend doing this; for instructions, see How to use dietlibc.