inittab(4) inittab(4)NAME inittab - script for the init process DESCRIPTION The inittab file supplies the script for the role init plays as a general process dispatcher. The process that consti- tutes the majority of the process dispatching activities of init is the line process /etc/getty that initiates individu- al terminal lines. Other processes typically dispatched by init are daemons and the shell. The inittab file is composed of entries that are position dependent and have the following format: id:rstate:action:process Each entry is delimited by a newline; however, a backslash (\) preceding a newline indicates a continuation of the en- try. Up to 512 characters per entry are permitted. Com- ments may be inserted in the process field using the sh(1) convention for comments. Comments for lines that spawn get- ty processes are displayed by the who(1) command. It is ex- pected that they will contain some information about the line, such as the location. There are no limits, other than maximum entry size, imposed on the number of entries within the inittab file. The entry fields are id This is one to four characters used to uniquely identify an entry. rstate This defines the run level in which this entry is to be processed. The entry, run levels effective- ly corresponds to a configuration of processes in the system. That is, each process spawned by init is assigned a run level or run levels in which it is allowed to exist. The run levels are represented by a number ranging from 0 through 6. As an example, if the system is in run level 1, only those entries having a 1 in the rstate field will be processed. When init is requested to change run levels, all processes which do not have an entry in the rstate field for the target run level will be sent the warning signal (SIGTERM) and allowed a 20-second grace period before being forcibly terminated by a kill signal (SIGKILL). The rstate field can define multiple run levels for a process by selecting more than one run level in any combination from 0-6. If no run level is specified, then the process is assumed to be valid at all run levels 0-6. There are three other values, a, b, and c, which can appear in the rstate field, even though they are not true April, 1990 1
inittab(4) inittab(4)run levels. Entries which have these characters in the rstate field are processed only when the init (see init(1M)) process requests them to be run (regardless of the current run level of the system). They differ from run levels in that init can never enter run level a, b, or c. Also, a re- quest for the execution of any of these processes does not change the current run level. Further- more, a process started by an a, b, or c command is not killed when init changes levels. They are only killed if their line in /etc/inittab is marked off in the action field, their line is deleted entirely from /etc/inittab, or init goes into the SINGLE USER state. action Key words in this field tell init how to treat the process specified in the process field. The ac- tions recognized by init are as follows: respawn If the process does not exist, then start the process (do not wait for its termination, that is, continue scanning the inittab file), and when it dies restart the process. If the process currently exists, then do nothing and continue scanning the inittab file. wait When init enters the run level that matches the entry's rstate, start the process and wait for its termi- nation. All subsequent reads of the inittab file while init is in the same run level will cause init to ignore this entry. once When init enters a run level that matches the entry's rstate, start the process, do not wait for its termination. When it dies, do not restart the process. If upon enter- ing a new run level, where the pro- cess is still running from a previ- ous run level change, the program will not be restarted. boot The entry is to be processed only at the boot-time read of the inittab file. init is to start the process, not wait for its termination; and when it dies, not restart the pro- cess. In order for this instruction 2 April, 1990
inittab(4) inittab(4)to be meaningful, the rstate should be the default or it must match init's run level at boot time. This action is useful for an initializa- tion function following a hardware reboot of the system. bootwait The entry is to be processed only at the boot-time read by init of the inittab file. init is to start the process, wait for its termination and, when it dies, not restart the process. powerfail Execute the process associated with this entry only when init receives a power fail signal (SIGPWR see sig- nal(3)). powerwait Execute the process associated with this entry only when init receives a power fail signal (SIGPWR) and wait until it terminates before continu- ing any processing of inittab. off If the process associated with this entry is currently running, send the warning signal (SIGTERM) and wait 20 seconds before forcibly terminating the process via the kill signal (SIGKILL). If the process is nonex- istent, ignore the entry. ondemand This instruction is really a synonym for the respawn action. It is func- tionally identical to respawn but is given a different keyword in order to divorce its association with run levels. This is used only with the a, b, or c values described in the rstate field. initdefault An entry with this action is only scanned when init is initially in- voked. init uses this entry, if it exists, to determine which run level to enter initially. It does this by taking the highest run level speci- fied in the rstate field and using that as its initial state. If the rstate field is empty, this is in- terpreted as 0123456 and so init April, 1990 3
inittab(4) inittab(4)will enter run level 6. Also, the initdefault entry can use s to specify that init start in the SIN- GLE USER state. Additionally, if init does not find an initdefault entry in /etc/inittab, then it will request an initial run level from the user at reboot time. sysinit Entries of this type are executed before init tries to access the con- sole. It is expected that this en- try will be used only to initialize devices on which init might try to ask the run level question. These entries are executed and waited for before continuing. process This is a sh command to be executed. The entire process field is prefixed with exec and passed to a forked sh as sh -c 'exec command' For this reason, any legal sh syntax can appear in the process field. Comments can be inserted with the # comment syntax. FILES /etc/inittab SEE ALSO sh(1), who(1), getty(1M), exec(2), open(2), signal(3). 4 April, 1990