System Administration Guide

The /etc/inittab File

When you boot the system or change run levels with the init or shutdown command, the init daemon starts processes by reading information from the /etc/inittab file. This file defines three important items for the init process:

Each entry in the /etc/inittab file has the following fields:

id:rstate:action:process

Table 6-2 describes the fields in an inittab entry.

Table 6-2 Fields in the inittab File

Field 

Description 

id

A unique identifier for the entry 

rstate

The run level, which corresponds to the command or (script) to be processed 

action

How the process specified in the process field is to be run 

process

The name of the process (or command) to execute 

Example--Default inittab File

The following example shows an annotated default inittab file:

 [STREAMS module initialization] ap::sysinit:/sbin/autopush -f /etc/iu.ap
 [Configures transport providers used by sockets. The sock2path file contains
a socket to transport provider map.] ap::sysinit:/sbin/soconfig -f /etc/sock2path
 [File system check] fs::sysinit:/sbin/rcS  >/dev/console 2>&1 </dev/console
 [Default run level] is:3:initdefault:
 [Power fail shutdown] p3:s1234:powerfail:/sbin/shutdown -y -i5 -g0 >/dev/console 2>&1 </dev/console
 [Run level 0] s0:0:wait:/sbin/rc0 >/dev/console 2>&1 </dev/console
 [Run level 2] s1:1:wait:/sbin/shutdown -y -iS -g0 >/dev/console 2>&1 </dev/console
 [Run level 3] s2:23:wait:/sbin/rc2 >/dev/console 2>&1 </dev/console
 [Run level 1] s3:3:wait:/sbin/rc3 >/dev/console 2>&1 </dev/console
 [Run level 5] s5:5:wait:/sbin/rc5 >/dev/console 2>&1 </dev/console
 [Run level 6] s6:6:wait:/sbin/rc6 >/dev/console 2>&1 </dev/console
 [Firmware] fw:0:wait:/sbin/uadmin 2 0 >/dev/console 2>&1 </dev/console
 [Off] of:5:wait:/sbin/uadmin 2 6 >/dev/console 2>&1 </dev/console
 [Reboot] rb:6:wait:/sbin/uadmin 2 1 >/dev/console 2>&1
 [Service access controller initialization] sc:234:respawn:/usr/lib/saf/sac -t 300
 [Console initialization] co:234:respawn:/usr/lib/saf/ttymon -g -h -p "`uname -n` console  login: " 
-T terminal_type -d /dev/console -l console -m ldterm,ttcompat

What Happens When the System Is Brought to Run Level 3

  1. The init process is started and reads the /etc/default/init file to set any environment variables. By default, only the TIMEZONE variable is set.

  2. Then init reads the inittab file to do the following:

    1. Identify the initdefault entry, which defines the default run level (3).

    2. Execute any process entries that have sysinit in the action field so that any special initializations can take place before users login.

    3. Execute any process entries that have 3 in the rstate field, which matches the default run level, 3.

      See init(1M) for a detailed description of how the init process uses the inittab file.

      Table 6-3 describes the key words used for run level 3's action field.

      Table 6-3 Run Level 3 Action Key Word Descriptions

      Key Word 

      Starts the Specified Process ... 

      powerfail

      Only when the system receives a power fail signal. 

      wait

      And waits for its termination. 

      respawn

      If it does not exist. If the process already exists, continue scanning the inittab file.

Table 6-4 describes the processes (or commands) executed at run level 3.

Table 6-4 Run Level 3 Command Descriptions

Command or Script Name 

Description 

/usr/sbin/shutdown

Shuts down the system. The init process runs the shutdown command only if the system has received a powerfail signal.

/sbin/rc2

Sets up the time zone, then starts the standard system processes, bringing the system up into run level 2 (multiuser mode). 

/sbin/rc3

Starts NFS resource sharing for run level 3. 

/usr/lib/saf/sac -t 30

Starts the port monitors and network access for UUCP. This process is restarted if it fails. 

/usr/lib/saf/ttymon -g -h -p "`uname -n` console login: " -T terminal_type -d /dev/console -l console

Starts the ttymon process that monitors the console for login requests. This process is restarted if it fails.

The terminal_type on a SPARC system is sun

The terminal_type on a x86 system is AT386