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
|
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<!--Converted with LaTeX2HTML 96.1-h (September 30, 1996) by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds -->
<HTML>
<HEAD>
<TITLE>Configuring init to start getty: the /etc/inittab file</TITLE>
<META NAME="description" CONTENT="Configuring init to start getty: the /etc/inittab file">
<META NAME="keywords" CONTENT="sag">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<LINK REL=STYLESHEET HREF="sag.css">
</HEAD>
<BODY LANG="EN" >
<A NAME="tex2html1257" HREF="node76.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="./next_motif.gif"></A> <A NAME="tex2html1255" HREF="node73.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="./up_motif.gif"></A> <A NAME="tex2html1249" HREF="node74.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="./previous_motif.gif"></A> <A NAME="tex2html1259" HREF="node1.html"><IMG WIDTH=65 HEIGHT=24 ALIGN=BOTTOM ALT="contents" SRC="./contents_motif.gif"></A> <A NAME="tex2html1260" HREF="node114.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="./index_motif.gif"></A> <BR>
<B> Next:</B> <A NAME="tex2html1258" HREF="node76.html">Run levels</A>
<B>Up:</B> <A NAME="tex2html1256" HREF="node73.html">init</A>
<B> Previous:</B> <A NAME="tex2html1250" HREF="node74.html">init comes first</A>
<BR> <P>
<A NAME="2381"> </A><H1><A NAME="SECTION00820000000000000000">Configuring <tt>init</tt><A NAME="2377"> </A> to start <tt>getty</tt><A NAME="2379"> </A>: the <tt>/etc/inittab</tt> file</A></H1>
<P>
When it starts up, <tt>init</tt><A NAME="2383"> </A> reads the <tt>/etc/inittab</tt><A NAME="2385"> </A>
configuration file. While the system is running, it will
re-read it, if sent the HUP signal;<A NAME="tex2html33" HREF="footnode.html#2310"><IMG ALIGN=BOTTOM ALT="gif" SRC="./foot_motif.gif"></A> this feature makes it
unnecessary to boot the system to make changes to the <tt>init</tt><A NAME="2389"> </A>
configuration take effect.
<P>
The <tt>/etc/inittab</tt><A NAME="2391"> </A> file is a bit complicated. We'll start
with the simple case of configuring <tt>getty</tt><A NAME="2393"> </A> lines. Lines in
<tt>/etc/inittab</tt><A NAME="2395"> </A> consist of four colon-delimited fields:
<BLOCKQUOTE> <i>id:runlevels:action:process</i>
</BLOCKQUOTE>
The fields are described below. In addition, <tt>/etc/inittab</tt><A NAME="2397"> </A>
can contain empty lines, and lines that begin with a number
sign (`<code>#</code>'); these are both ignored.
<P>
<DL ><DT><STRONG>id</STRONG>
<DD> This identifies the line in the file. For
<tt>getty</tt><A NAME="2399"> </A> lines, it specifies the terminal
it runs on (the characters after <tt>/dev/tty</tt><A NAME="2401"> </A>
in the device file name). For other lines,
it doesn't matter (except for length restrictions),
but it should be unique.
<P>
<DT><STRONG>runlevels</STRONG>
<DD>
The run levels the line should be considered
for. The run levels are given as single digits,
without delimiters. (Run levels are described
in the next section.)
<P>
<DT><STRONG>action</STRONG>
<DD> What action should be taken by the line, e.g.,
<tt>respawn</tt> to run the command in the
next field again, when it exits, or <tt>once</tt>
to run it just once.
<P>
<DT><STRONG>process</STRONG>
<DD> The command to run.
<P>
</DL>
<P>
To start a <tt>getty</tt><A NAME="2403"> </A> on the first virtual terminal
(<tt>/dev/tty1</tt><A NAME="2405"> </A>), in all the normal multi-user run levels
(2-5), one would write the following line:
<BLOCKQUOTE> <TT>
1:2345:respawn:/sbin/getty 9600 tty1
</TT></BLOCKQUOTE>
The first field says that this is the line for <tt>/dev/tty1</tt><A NAME="2407"> </A>.
The second field says that it applies to run levels 2, 3, 4,
and 5. The third field means that the command should be run
again, after it exits (so that one can log in, log out, and
then log in again). The last field is the command that runs
<tt>getty</tt><A NAME="2409"> </A> on the first virtual terminal.<A NAME="tex2html34" HREF="footnode.html#2311"><IMG ALIGN=BOTTOM ALT="gif" SRC="./foot_motif.gif"></A>
<P>
If you wanted to add terminals or dial-in modem lines to a system,
you'd add more lines to <tt>/etc/inittab</tt><A NAME="2413"> </A>, one for each terminal
or dial-in line. For more details, see the manual pages
<em>init</em><A NAME="2415"> </A>(8), <em>inittab</em><A NAME="2417"> </A>(5), and <em>getty</em><A NAME="2419"> </A>(8).
<P>
If a command fails when it starts, and <tt>init</tt><A NAME="2421"> </A> is configured
to <tt>restart</tt> it, it will use a lot of system resources:
<tt>init</tt><A NAME="2423"> </A> starts it, it fails, <tt>init</tt><A NAME="2425"> </A> starts it, it fails,
<tt>init</tt><A NAME="2427"> </A> starts it, it fails, and so on, ad infinitum. To
prevent this, <tt>init</tt><A NAME="2429"> </A> will keep track of how often it restarts
a command, and if the frequency grows to high, it will delay for
five minutes before restarting again.
<P>
<HR><A NAME="tex2html1257" HREF="node76.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="./next_motif.gif"></A> <A NAME="tex2html1255" HREF="node73.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="./up_motif.gif"></A> <A NAME="tex2html1249" HREF="node74.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="./previous_motif.gif"></A> <A NAME="tex2html1259" HREF="node1.html"><IMG WIDTH=65 HEIGHT=24 ALIGN=BOTTOM ALT="contents" SRC="./contents_motif.gif"></A> <A NAME="tex2html1260" HREF="node114.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="./index_motif.gif"></A> <BR>
<B> Next:</B> <A NAME="tex2html1258" HREF="node76.html">Run levels</A>
<B>Up:</B> <A NAME="tex2html1256" HREF="node73.html">init</A>
<B> Previous:</B> <A NAME="tex2html1250" HREF="node74.html">init comes first</A>
<P><ADDRESS>
<I>Lars Wirzenius <BR>
Sat Nov 15 02:32:11 EET 1997</I>
</ADDRESS>
</BODY>
</HTML>
|