1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
|
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title>runit - a UNIX init scheme with service supervision</title>
</head>
<body>
<a href="http://smarden.org/pape/">G. Pape</a>
<hr>
<h1>runit - a UNIX init scheme with service supervision</h1>
<hr>
<a href="install.html">How to install runit</a><br>
<a href="upgrade.html">Upgrading from previous versions of runit</a>
<p>
<a href="benefits.html">Benefits</a><br>
<a href="replaceinit.html">How to replace init</a><br>
<a href="usedietlibc.html">How to use dietlibc</a>
<p>
<a href="runlevels.html">Runlevels</a><br>
<a href="http://smarden.org/pape/djb/daemontools/noinit.html">
Dependencies</a><br>
<a href="runscripts.html">A collection of run scripts</a><br>
<p>
<a href="runit.8.html">The <tt>runit</tt> program</a><br>
<a href="runit-init.8.html">The <tt>runit-init</tt> program</a><br>
<br>
<a href="runsvdir.8.html">The <tt>runsvdir</tt> program</a><br>
<a href="runsv.8.html">The <tt>runsv</tt> program</a><br>
<a href="runsvchdir.8.html">The <tt>runsvchdir</tt> program</a><br>
<br>
<a href="svlogd.8.html">The <tt>svlogd</tt> program</a><br>
<br>
<a href="utmpset.8.html">The <tt>utmpset</tt> program</a><br>
<a href="svwaitdown.8.html">The <tt>svwaitdown</tt> program</a><br>
<a href="svwaitup.8.html">The <tt>svwaitup</tt> program</a><br>
<br>
<a href="runsvstat.8.html">The <tt>runsvstat</tt> program</a>
(not installed by default)<br>
<a href="runsvctrl.8.html">The <tt>runsvctrl</tt> program</a>
(not installed by default)
<hr>
<i>runit</i> is a
<a href="http://cr.yp.to/daemontools.html">daemontools</a> alike
replacement for
<a href="ftp://ftp.cistron.nl/pub/people/miquels/sysvinit/">sysvinit</a>
and other init schemes. <i>runit</i> runs on <b>GNU/Linux</b>,
<b>OpenBSD</b>, <b>FreeBSD</b>, and can easily be adapted to other unix
operating systems.
If <i>runit</i> runs for you on any other operating system or linux
distribution, please let me know.
<p>
<b>Warning:</b> Replacing <i>sysvinit</i> or <i>init</i> 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
<tt>init=/bin/sh</tt> to the kernel.
<hr>
<i>runit</i> is discussed on the
<a href="http://skarnet.org/lists/#supervision">
<supervision@list.skarnet.org></a>
mailing list. To subscribe send an empty email to
<a href="mailto:supervision-subscribe@list.skarnet.org">
<supervision-subscribe@list.skarnet.org></a>.
<hr>
The command <a href="runit.8.html">runit</a> is intended to run as Unix
process no 1, it is automatically started by the
<a href="runit-init.8.html">runit-init</a> <tt>/sbin/init</tt>-replacement
if this is started by the kernel.
<p>
<a href="runit.8.html">runit</a> performs the system's <i>booting</i>,
<i>running</i> and <i>shutting down</i> in <b>three stages</b>:
<ul>
<li><b>Stage 1:</b><br>
<i>runit</i> starts <tt>/etc/runit/1</tt> and waits for it to
terminate. The system's one time initialization tasks are done here.
<tt>/etc/runit/1</tt> has full control of <tt>/dev/console</tt> to be
able to start an emergency shell if the one time initialization tasks
fail.
<li><b>Stage 2:</b><br>
<i>runit</i> starts <tt>/etc/runit/2</tt> which should not return
until the system is going to halt or reboot, if it crashes, it will be
restarted. Normally, <tt>/etc/runit/2</tt> runs
<a href="runsvdir.8.html">runsvdir</a>.
In Stage 2 <i>runit</i> optionally handles an INT signal
(ctrl-alt-del keyboard request on Linux/i386).
<li><b>Stage 3:</b><br>
If <i>runit</i> is told to halt or reboot the system, or the Stage 2
returns without errors, it terminates Stage 2 if it is running and runs
<tt>/etc/runit/3</tt>. The systems tasks to shutdown and halt or
reboot are done here.
</ul>
These are working examples for debian woody:
<a href="debian/1">/etc/runit/1</a>,
<a href="debian/2">/etc/runit/2</a>,
<a href="debian/3">/etc/runit/3</a>.
<p>
The command <a href="runit-init.8.html">runit-init</a> is intended to
replace <tt>/sbin/init</tt>. sysvinit's command <tt>shutdown</tt> will
keep working. On *BSD systems use <b><tt>init 0</tt></b> for system halt
and <b><tt>init 6</tt></b> for reboot.
<a href="runlevels.html">Runlevels</a> are handled through the
<a href="runsvdir.8.html">runsvdir</a> and
<a href="runsvchdir.8.html">runsvchdir</a> programs. Service dependencies
are rudimentarily handled through the <a href="svwaitup.8.html">svwaitup</a>
and <a href="svwaitdown.8.html">svwaitdown</a> programs, see
<a href="http://smarden.org/pape/djb/daemontools/noinit.html">
Dependencies and runlevels</a> for an example.
<p>
<i>runit</i> is optimized for reliability and small size. The amount of
code in process no 1 should be minimal.
<hr>
<b><i>runit</i> in use</b>: I replaced <i>sysvinit</i> with <i>runit</i>
on several server systems and a laptop running Debian/GNU Linux sarge, woody
and potato, and did not encounter any problems. Of course also the
<tt>smarden.org</tt> content server is running with <i>runit</i> as process
no 1, here is an example:
<pre>
# strings /proc/1/exe |grep Id
$Id: runit.c,v 1.7 2002/02/13 09:59:52 pape Exp $
# uptime
08:53:39 up 178 days, 19:11, 1 user, load average: 0.24, 0.12, 0.04
# ps axuw |head -n20
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 20 16 ? S 2002 0:06 runit
root 2 0.0 0.0 0 0 ? SW 2002 0:00 [keventd]
root 3 0.0 0.0 0 0 ? SWN 2002 0:00 [ksoftirqd_CPU0]
root 4 0.0 0.0 0 0 ? SW 2002 1:29 [kswapd]
root 5 0.0 0.0 0 0 ? SW 2002 0:02 [bdflush]
root 6 0.0 0.0 0 0 ? SW 2002 0:10 [kupdated]
root 168 0.0 0.0 1652 216 ? S 2002 0:00 /usr/sbin/cron
root 174 0.0 0.0 36 24 ? S 2002 0:00 runsvdir /var/service log: ....................................................................................................
root 176 0.0 0.0 20 20 ? S 2002 0:00 runsv qmail-send
root 177 0.0 0.0 20 20 ? S 2002 0:00 runsv getty-5
root 178 0.0 0.0 20 20 ? S 2002 0:00 runsv getty-4
root 179 0.0 0.0 20 20 ? S 2002 0:00 runsv getty-3
root 180 0.0 0.0 20 20 ? S 2002 0:00 runsv getty-2
root 182 0.0 0.0 20 20 ? S 2002 0:00 runsv socklog-unix
root 183 0.0 0.0 1256 40 tty5 S 2002 0:00 getty 38400 tty5 linux
root 184 0.0 0.0 1256 40 tty3 S 2002 0:00 getty 38400 tty3 linux
root 185 0.0 0.0 20 20 ? S 2002 0:00 runsv socklog-klog
root 186 0.0 0.0 20 20 ? S 2002 0:00 runsv ssh
root 187 0.0 0.0 1256 40 tty4 S 2002 0:00 getty 38400 tty4 linux
# pstree
runit-+-bdflush
|-cron
|-keventd
|-ksoftirqd_CPU0
|-kswapd
|-kupdated
`-runsvdir-+-runsv-+-multilog
| `-qmail-send-+-qmail-clean
| |-qmail-lspawn
| `-qmail-rspawn
|-4*[runsv---getty]
|-2*[runsv-+-multilog]
| `-socklog]
|-runsv-+-multilog
| `-sshd-+-sshd---sshd
| `-sshd---sshd---bash---bash---pstree
|-runsv---clockspeed
|-runsv-+-dnscache
| `-multilog
|-runsv---apache-ssl-+-12*[apache-ssl]
| |-gcache
| `-4*[multilog]
|-6*[runsv-+-multilog]
| `-tcpserver]
|-3*[runsv-+-multilog]
| `-tinydns]
|-runsv---uncat
`-2*[runsv-+-multilog]
`-tcpsvd]
</pre>
This is from a more busy system:
<pre>
# 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
</pre>
<hr>
See <a href="install.html">How to install runit</a> for installing
<i>runit</i> and <a href="replaceinit.html">How to replace init</a> for
smoothly escaping from <i>sysvinit</i>.
<hr>
If <i>runit</i> on linux is compiled and linked with
<a href="http://www.fefe.de/dietlibc/">dietlibc</a> it yields in a statically
linked <tt>runit</tt> binary of 8.5k size and this <tt>ps axuw</tt> output
on my system:
<pre>
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 20 16 ? S 2002 0:02 runit
</pre>
I recommend doing this; for instructions, see
<a href="usedietlibc.html">How to use dietlibc</a>.
<hr>
See <a href="http://smarden.org/runit/">http://smarden.org/runit/</a>
for recent informations.
<hr>
Related links:
<ul>
<li><a href="http://www.fefe.de/minit/">minit</a>
<li><a href="http://multivac.cwru.edu/svscan-1/">svscan as process 1</a>
<li><a href="ftp://ftp.cistron.nl/pub/people/miquels/sysvinit/">
sysvinit</a>
<li><a href="http://www.openbsd.org/cgi-bin/cvsweb/src/sbin/init/">
OpenBSD's init</a>
<li><a href="http://www.freebsd.org/cgi/cvsweb.cgi/src/sbin/init/">
FreeBSD's init</a>
<li><a href="http://www.atnf.csiro.au/~rgooch/linux/boot-scripts/">
Richard Gooch's Linux Boot Scripts</a>
</ul>
<hr>
<address><a href="mailto:pape@smarden.org">
Gerrit Pape <pape@smarden.org>
</a></address>
<small>$Id$</small>
</body>
</html>
|