|
|
The /etc/init program starts during the last phase of kernel initialization and has a ``process id'' (PID) of ``1''. The init process starts all other processes. The /etc/inittab file contains instructions for init. The init program reads the inittab file under three circumstances: at boot time, when an init-started process completes, and when the system administrator executes either the /etc/init or /bin/telinit command with a run-level argument. The arguments passed to init allow you to change the system run level or force init to examine the inittab file without changing the run level. When the system changes run levels, init scans inittab for instructions that apply to the new state.
The
inittab
file is made up of entries that contain
four fields separated by colons:
label:run_level:action:process
If there is more than one run level specified for an inittab entry, the levels appear in the second field without separators. If the run level field is empty, the entry is executed in all numeric run levels (0-6). When the run level changes, any process that does not have an entry for the new run level receives a warning signal (15). If the process does not terminate after 5 seconds, it receives a kill signal (9). The current state of the init process determines how it executes the inittab entry.
When the init program is initially invoked, it scans inittab for entries that contain the action keywords described in ``inittab single-user keywords''. These entries are executed only during init's boot-time read of inittab.
inittab single-user keywords
When the run level changes from single-user to a numeric run level (0-6), init scans entries with the actions in ``inittab run_level field keywords'' and executes only those entries with the appropriate ``run_level'' field set.
inittab run_level field keywords
If the system hardware is capable of detecting power failure and init receives a power failure signal, init executes entries containing the actions shown in ``inittab powerfail keywords'' if the run level is appropriate.
inittab powerfail keywords
In the following example, the inittab entry sets the default run level for the system to single-user mode when init is initially invoked:
is:S:initdefault:
You can configure your system to come up in multiuser mode by editing this inittab entry, changing the ``S'' in the run-level field to a ``2''.
The following inittab entry runs the /etc/bcheckrc script when the system is booted (or rebooted) and waits for the process to complete before processing the next entry. (The bcheckrc script checks the filesystems and sets the date.)
bchk::sysinit:/etc/bcheckrc </dev/console >/dev/console 2>&1The init process also starts the /etc/getty program according to instructions in inittab. The getty (``get a tty'') program sets up communication between the system and terminals. For more information, see the getty(M) manual page.
The following example inittab entry tells init to start a getty process (if one does not already exist) for tty01 (the console) at 9600 baud when the current run level is 2:
co:2:respawn:/etc/getty tty01 sc_mThe respawn action instructs init to restart the getty process each time it dies and to continue processing the next inittab entry without waiting for the current process to complete. By changing the action from respawn to wait, you tell init to wait until the current process has finished before reading the next entry in inittab.
See the inittab(F) manual page for a detailed description of the format of the inittab file and an explanation of the action keywords.
To make your changes to inittab effective immediately, execute the telinit Q command. This command causes init to reexamine the modified inittab file without changing the run level.