index.txt
INIT(8) System Manager's Manual INIT(8) NAME init, rc - process control initialization SYNOPSIS /etc/init /etc/rc DESCRIPTION Init is invoked as the last step of the boot procedure (see boot(8)). Generally its role is to create a process for each typewriter on which a user may log in. When init first is executed the console typewriter /dev/console. is opened for reading and writing and the shell is invoked immediately. This feature is used to bring up a single-user system. If the shell terminates, init comes up multi-user and the process described below is started. When init comes up multiuser, it invokes a shell, with input taken from the file /etc/rc. This command file performs housekeeping like remov‐ ing temporary files, mounting file systems, and starting daemons. Then init reads the file /etc/ttys and forks several times to create a process for each typewriter specified in the file. Each of these pro‐ cesses opens the appropriate typewriter for reading and writing. These channels thus receive file descriptors 0, 1 and 2, the standard input, output and error files. Opening the typewriter will usually involve a delay, since the open is not completed until someone is dialed up and carrier established on the channel. Then /etc/getty is called with ar‐ gument as specified by the last character of the ttys file line. Getty reads the user's name and invokes login(1) to log in the user and exe‐ cute the shell. Ultimately the shell will terminate because of an end-of-file either typed explicitly or generated as a result of hanging up. The main path of init, which has been waiting for such an event, wakes up and removes the appropriate entry from the file utmp, which records current users, and makes an entry in /usr/adm/wtmp, which maintains a history of lo‐ gins and logouts. Then the appropriate typewriter is reopened and getty is reinvoked. Init catches the hangup signal SIGHUP and interprets it to mean that the system should be brought from multi user to single user. Use `kill -1 1' to send the hangup signal. FILES /dev/tty?, /etc/utmp, /usr/adm/wtmp, /etc/ttys, /etc/rc SEE ALSO login(1), kill(1), sh(1), ttys(5), getty(8) INIT(8)