As promised we next take a closer look at
/etc/inttab.
The file has the following structure:
id : runlevel : action : command
The id field can be anything up to 4
characters long. If a runlevel is specified
then the command and the required
action will be performed only at that specific runlevel.
If no number is specified then the line is executed at any run level.
| Action | Description |
|---|---|
boot | Performed only at boot time |
crtlaltdel | Associate a command when SIGINT is caught by init |
initdefault | Define which runlevel to attain at boot time |
respawn | Follow process and respawn it when it dies |
sysinit | Is perform at boot only, before any boot
requests |
wait | Starts the process and waits before starting a new one |
Recognisable features in the /etc/inittab
file
id and the action initdefault. Notice
that no command is given. This line simply tells init
what the default runlevel is./etc/rc.d/rc.sysinit. This script
sets system defaults such as the PATH variable,
determines if networking is allowed, the hostname, etc
If the default runlevel is 3 then only the line
l3 will be executed. The action is wait,
no other program is launched until all services in run level 3 are
running
The lines with id's 1 to 6
launch the virtual terminals. This is where you can alter the number of
virtual terminals
The final line in inittab launches
the Xwindow manager if runlevel 5 is
reached.
Figure 2.2. The /etc/inittab
file
id:3:initdefault: # System initialization. si::sysinit:/etc/rc.d/rc.sysinit l0:0:wait:/etc/rc.d/rc 0 l1:1:wait:/etc/rc.d/rc 1 l2:2:wait:/etc/rc.d/rc 2 l3:3:wait:/etc/rc.d/rc 3 l4:4:wait:/etc/rc.d/rc 4 l5:5:wait:/etc/rc.d/rc 5 l6:6:wait:/etc/rc.d/rc 6 -----------------------snip-------------------------- # Trap CTRL-ALT-DELETE ca::ctrlaltdel:/sbin/shutdown -t3 -r now -----------------------snip-------------------------- # Run gettys in standard runlevels 1:2345:respawn:/sbin/mingetty tty1 2:2345:respawn:/sbin/mingetty tty2 3:2345:respawn:/sbin/mingetty tty3 4:2345:respawn:/sbin/mingetty tty4 5:2345:respawn:/sbin/mingetty tty5 6:2345:respawn:/sbin/mingetty tty6 # Run xdm in runlevel 5 x:5:respawn:/etc/X11/prefdm nodaemon
Remarks
You can set a modem to listen for connections in
inittab. If your modem is linked to
/dev/ttyS1 then the following line will allow data
connections (no fax) after 2 rings
S1:12345:respawn:/sbin/mgetty -D -x 2 /dev/ttyS1
When making changes to /etc/inittab
you need to force init to reread this configuration
file. This can be done using:
/sbin/init q