INITTAB(5)

NAME
inittab — format of the inittab file used by init

DESCRIPTION
The inittab file defines the processes that are to be spawned by init at various run levels.

The inittab file is composed of entries that are position dependent and have the following format:

id:rstate:action:process

Blank lines and lines beginning with '#' are ignored. There are no limits imposed on the number of entries or the size of individual entries within the inittab file. The fields are defined as follows:

id  A strings used to uniquely identify an entry. Any number of characters may be used. The SYSV standard calls for 4 characters however Linux will only use the first two to identify the relevent utmp entry.

rstate
    Defines the run levels in which this entry will be processed. Run levels 0 to 9 correspond to specific configurations of the system. When init is instructed to change from one run level to another it will kill all processes that exist in the old run level but not the new run level and then start all processes that exist in the new run level but aren't currently running. Non-numeric characters in the rstat field correspond to on demand states. The processes will be started whenever telinit requests that level but init will never actually enter the level, it will remain in the current run level. Furthermore a process started in this way will not be killed when init changes run level.

action
    Key words in this field tell init how to treat the process specified in the process field.

process
    specifies the process to be executed. The entire process field is prefixed with exec and passed to a forked shell as sh -c 'exec command'. Therefore any legal sh syntax can appear in the process field.

The actions recognized by init are as follows:

respawn
    If the process does not exist then it is started and scanning of inittab continues without waiting for the process to terminate. If the process currently exists scanning continues without any attept to start the process. When the process terminates it will be restarted.

wait
    When init enters a valid run level for this process the process will be started and init will wait for it to terminate before continuing scanning inittab. This entry will then be ignored as long as init remains in this run level.

endlevel
    When init exits a run level valid for this process the process will be started and init will wait for it to terminate before continuing scanning inittab.

once
    When init enters a valid run level for this process the process will be started and init will continue scanning the inittab immediately. When the process exits it will not be restarted. If upon entering a run level the process is still running from a previous run level it will not be restarted again.

boot
    Init starts the process when the system enters a multi-user state for the first time. It does not wait for the process to terminate before continuing. When the process does terminate it is not restarted. The rstate field is ignored for boot processes.

bootwait
    Init starts the process when the system enters a multi-user state for the first time. It waits for the process to terminate before continuing. When the process terminates it is not restarted. The rstate field is ignored for bootwait processes.

powerfail
    The process is started when init receives a power fail signal (SIGSTOP under Linux). Init does not wait for the process to terminate before continuing. The rstate field is ignored for powerfail processes.

powerwait
    The process is started when init receives a power fail signal (SIGSTOP under Linux). Init waits for the process to terminate before continuing. The rstate field is ignored for powerwait processes.

off If the process is currently running it will be terminated. If the process is not running this entry is ignored.

ondemand
    This is a synonym for the respawn action. It is functionally identical to the respawn action but is given a different keyword to avoid association with run levels. This keyword is generally used with for processes active in non-numeric run levels which are triggered on demand.

initdefault
    This entry is processed when init first starts up. The rstate field specifies the run level which init will enter initially. If no initdefault entry is found in inittab then init will start the system in single user mode.

sysinit
    These entries are processed by init when the system first starts up and before any other processing is done. Init will start each process and wait for it to complete in turn. These entries are generally used to configure the hardware, check the root filesystem etc.

update
    The process field of this entry is used to specify how often init should issue the sync() system call in seconds. The rstate field is considered allowing different frequencies to be used at different run levels. A blank rstate field defines the default frequency which to be used. Periodic syncing starts only after all sysinit processes have been run. This is a non-standard addition to init.

bdflush
    The process field of this entry is used to specify how often init should issue the bdflush() system call in seconds. An entry of this type causes init to spawn the master bdflush process when it first starts up. If the periodic bdflush() fails then init will fall back to using periodic sync() calls (if an update line is in effect). All other behaviour for entries of this type are as update above.

runlevel
    These entries are used to give names to run levels. The run level to be named is given in the rstate field and the name of the run level is given in the process field. Run levels may have multiple names. Run level names may be used instead of run levels as arguments to telinit or as arguments on the boot command line [see init(1)]. This is a non-standard addition to init.

When a run level change request is made, init sends a notification signal SIGTERM to all processes that are not defined in the target run level. It then waits 5 seconds and sends a warning signal SIGINT to the processes, waits another 2 seconds and then forcibly terminates them using the kill signal SIGKILL.

FILES
/etc/inittab

SEE ALSO
init(8),telinit(8)