Document length limit for the process field in the inittab. Patch
[sysvinit.git] / man / inittab.5
CommitLineData
a74aeac6
PR
1'\" -*- coding: UTF-8 -*-
2.\" Copyright (C) 1998-2001 Miquel van Smoorenburg.
3.\"
4.\" This program is free software; you can redistribute it and/or modify
5.\" it under the terms of the GNU General Public License as published by
6.\" the Free Software Foundation; either version 2 of the License, or
7.\" (at your option) any later version.
8.\"
9.\" This program is distributed in the hope that it will be useful,
10.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
11.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12.\" GNU General Public License for more details.
13.\"
14.\" You should have received a copy of the GNU General Public License
15.\" along with this program; if not, write to the Free Software
16.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17.\"
18.\"{{{}}}
19.\"{{{ Title
20.TH INITTAB 5 "Dec 4, 2001" "" "Linux System Administrator's Manual"
21.\"}}}
22.\"{{{ Name
23.SH NAME
24inittab \- format of the inittab file used by the sysv-compatible init
25process
26.\"}}}
27.\"{{{ Description
28.SH DESCRIPTION
29The \fBinittab\fP file describes which processes are started at bootup and
30during normal operation (e.g.\& /etc/init.d/boot, /etc/init.d/rc, gettys...).
31.BR Init (8)
32distinguishes multiple \fIrunlevels\fP, each of which can have its own set of
33processes that are started. Valid runlevels are \fB0\fP\-\fB6\fP plus
34\fBA\fP, \fBB\fP, and \fBC\fP for \fBondemand\fP entries. An entry in the
35\fBinittab\fP file has the following format:
36.RS
37.sp
38\fIid\fP:\fIrunlevels\fP:\fIaction\fP:\fIprocess\fP
39.sp
40.RE
41Lines beginning with `#' are ignored.
42.\"{{{ id
43.IP \fIid\fP
44is a unique sequence of 1-4 characters which identifies an entry in
45.B inittab
46(for versions of sysvinit compiled with the \fIold\fP libc5 (< 5.2.18) or
47a.out libraries the limit is 2 characters).
48.sp
49Note: traditionally, for getty and other login processes, the value of the
50\fIid\fP field is kept the same as the suffix of the corresponding tty, e.g.\&
51\fB1\fP for \fBtty1\fP. Some ancient login accounting programs might
52expect this, though I can't think of any.
53.\"}}}
54.\"{{{ runlevels
55.IP \fIrunlevels\fP
56lists the runlevels for which the specified action should be taken.
57.\"}}}
58.\"{{{ action
59.IP \fIaction\fP
60describes which action should be taken.
61.\"}}}
62.\"{{{ process
63.IP \fIprocess\fP
64specifies the process to be executed. If the process field starts with
65a `+' character,
66.B init
67will not do utmp and wtmp accounting for that process. This is needed for
68gettys that insist on doing their own utmp/wtmp housekeeping. This is also
3f0ea6c4 69a historic bug. The length of this field is limited to 127 characters.
a74aeac6
PR
70.\"}}}
71.PP
72The \fIrunlevels\fP field may contain multiple characters for different
73runlevels. For example, \fB123\fP specifies that the process should be
74started in runlevels 1, 2, and 3.
75The \fIrunlevels\fP for \fBondemand\fP entries may contain an \fBA\fP,
76\fBB\fP, or \fBC\fP. The \fIrunlevels\fP field of \fBsysinit\fP,
77\fBboot\fP, and \fBbootwait\fP entries are ignored.
78.PP
79When the system runlevel is changed, any running processes that are not
80specified for the new runlevel are killed, first with \s-2SIGTERM\s0,
81then with \s-2SIGKILL\s0.
82.PP
83Valid actions for the \fIaction\fP field are:
84.\"{{{ respawn
85.IP \fBrespawn\fP
86The process will be restarted whenever it terminates (e.g.\& getty).
87.\"}}}
88.\"{{{ wait
89.IP \fBwait\fP
90The process will be started once when the specified runlevel is entered and
91.B init
92will wait for its termination.
93.\"}}}
94.\"{{{ once
95.IP \fBonce\fP
96The process will be executed once when the specified runlevel is
97entered.
98.\"}}}
99.\"{{{ boot
100.IP \fBboot\fP
101The process will be executed during system boot. The \fIrunlevels\fP
102field is ignored.
103.\"}}}
104.\"{{{ bootwait
105.IP \fBbootwait\fP
106The process will be executed during system boot, while
107.B init
108waits for its termination (e.g.\& /etc/rc).
109The \fIrunlevels\fP field is ignored.
110.\"}}}
111.\"{{{ off
112.IP \fBoff\fP
113This does nothing.
114.\"}}}
115.\"{{{ ondemand
116.IP \fBondemand\fP
117A process marked with an \fBondemand\fP runlevel will be executed
118whenever the specified \fBondemand\fP runlevel is called. However, no
119runlevel change will occur (\fBondemand\fP runlevels are `a', `b',
120and `c').
121.\"}}}
122.\"{{{ initdefault
123.IP \fBinitdefault\fP
124An \fBinitdefault\fP entry specifies the runlevel which should be
125entered after system boot. If none exists,
126.B init
127will ask for a runlevel on the console. The \fIprocess\fP field is ignored.
128.\"}}}
129.\"{{{ sysinit
130.IP \fBsysinit\fP
131The process will be executed during system boot. It will be
132executed before any \fBboot\fP or \fB bootwait\fP entries.
133The \fIrunlevels\fP field is ignored.
134.\"}}}
135.\"{{{ powerwait
136.IP \fBpowerwait\fP
137The process will be executed when the power goes down. Init is usually
138informed about this by a process talking to a UPS connected to the computer.
139\fBInit\fP will wait for the process to finish before continuing.
140.\"}}}
141.\"{{{ powerfail
142.IP \fBpowerfail\fP
143As for \fBpowerwait\fP, except that \fBinit\fP does not wait for the process's
144completion.
145.\"}}}
146.\"{{{ powerokwait
147.IP \fBpowerokwait\fP
148This process will be executed as soon as \fBinit\fP is informed that the
149power has been restored.
150.\"}}}
151.\"{{{ powerfailnow
152.IP \fBpowerfailnow\fP
153This process will be executed when \fBinit\fP is told that the battery of
154the external UPS is almost empty and the power is failing (provided that the
155external UPS and the monitoring process are able to detect this condition).
156.\"}}}
157.\"{{{ ctrlaltdel
158.IP \fBctrlaltdel\fP
159The process will be executed when \fBinit\fP receives the SIGINT signal.
160This means that someone on the system console has pressed the
161\fBCTRL\-ALT\-DEL\fP key combination. Typically one wants to execute some
162sort of \fBshutdown\fP either to get into single\-user level or to
163reboot the machine.
164.\"}}}
165.\"{{{ kbrequest
166.IP \fBkbrequest\fP
167The process will be executed when \fBinit\fP receives a signal from the
168keyboard handler that a special key combination was pressed on the
169console keyboard.
170.sp
171The documentation for this function is not complete yet; more documentation
172can be found in the kbd-x.xx packages (most recent was kbd-0.94 at
173the time of this writing). Basically you want to map some keyboard
174combination to the "KeyboardSignal" action. For example, to map Alt-Uparrow
175for this purpose use the following in your keymaps file:
176.RS
177.sp
178alt keycode 103 = KeyboardSignal
179.sp
180.RE
181.\"}}}
182.\"}}}
183.\"{{{ Examples
184.SH EXAMPLES
185This is an example of a inittab which resembles the old Linux inittab:
186.RS
187.sp
188.nf
189.ne 7
190# inittab for linux
191id:1:initdefault:
192rc::bootwait:/etc/rc
1931:1:respawn:/etc/getty 9600 tty1
1942:1:respawn:/etc/getty 9600 tty2
1953:1:respawn:/etc/getty 9600 tty3
1964:1:respawn:/etc/getty 9600 tty4
197.fi
198.sp
199.RE
200This inittab file executes \fB/etc/rc\fP during boot and starts gettys
201on tty1\-tty4.
202.PP
203A more elaborate \fBinittab\fP with different runlevels (see the comments
204inside):
205.RS
206.sp
207.nf
208.ne 19
209# Level to run in
210id:2:initdefault:
211
212# Boot-time system configuration/initialization script.
213si::sysinit:/etc/init.d/rcS
214
215# What to do in single-user mode.
216~:S:wait:/sbin/sulogin
217
218# /etc/init.d executes the S and K scripts upon change
219# of runlevel.
220#
221# Runlevel 0 is halt.
222# Runlevel 1 is single-user.
223# Runlevels 2-5 are multi-user.
224# Runlevel 6 is reboot.
225
226l0:0:wait:/etc/init.d/rc 0
227l1:1:wait:/etc/init.d/rc 1
228l2:2:wait:/etc/init.d/rc 2
229l3:3:wait:/etc/init.d/rc 3
230l4:4:wait:/etc/init.d/rc 4
231l5:5:wait:/etc/init.d/rc 5
232l6:6:wait:/etc/init.d/rc 6
233
234# What to do at the "3 finger salute".
235ca::ctrlaltdel:/sbin/shutdown -t1 -h now
236
237# Runlevel 2,3: getty on virtual consoles
238# Runlevel 3: getty on terminal (ttyS0) and modem (ttyS1)
2391:23:respawn:/sbin/getty tty1 VC linux
2402:23:respawn:/sbin/getty tty2 VC linux
2413:23:respawn:/sbin/getty tty3 VC linux
2424:23:respawn:/sbin/getty tty4 VC linux
243S0:3:respawn:/sbin/getty -L 9600 ttyS0 vt320
244S1:3:respawn:/sbin/mgetty -x0 -D ttyS1
245
246.fi
247.sp
248.RE
249.\"}}}
250.\"{{{ Files
251.SH FILES
252/etc/inittab
253.\"}}}
254.\"{{{ Author
255.SH AUTHOR
256\fBInit\fP was written by Miquel van Smoorenburg
257(miquels@cistron.nl). This manual page was written by
258Sebastian Lederer (lederer@francium.informatik.uni-bonn.de) and modified
259by Michael Haardt (u31b3hs@pool.informatik.rwth-aachen.de).
260.\"}}}
261.\"{{{ See also
262.SH "SEE ALSO"
263.BR init (8),
264.BR telinit (8)
265.\"}}}