COHERENT manpages
This page displays the COHERENT manpage for init [System initialization].
List of available manpages
Index
init -- System Administration System initialization /etc/init COHERENT invokes processes in special order. The kernel invokes the command init as the initial process in the system. init runs as long as the system remains up. init is the first process that the kernel starts. The kernel always gives this process identifier 1. init has two primary tasks: First, it guides the system through the latter stages of booting and entering multi-user mode. Second, it launches the appropriate processes so that users can log in and log out of COHERENT correctly. The rest of this article describes how init performs these tasks. Booting and Entering Multi-user Mode The following that init performs as it guides the system through entering multi-user mode. First, if file /usr/adm/wtmp exists, init records there the date and time at which the system is being booted. init then executes the shell script /etc/brc. This script usually loads the keyboard table and invokes the command fsck to check the file systems for errors If this script returns zero, then init enters multi-user mode; if not, it spawns the single-user shell. When the user at the console terminates the single-user shell (usually by typing <ctrl-D>), init executes script /etc/rc and brings the system up to the multiuser state. /etc/rc performs such chores as setting the time zone, removing stale temporary files and lock files, and initializing the modem. If you wish, it can invoke the command accton to enable process accounting. init then reads file /etc/ttys. For every local, enabled line, init spawns the command getty with two arguments: the name of the port, and its speed (as given in /etc/ttys). Before it spawns a getty, init sets the group number for a new process group. For a remote line, init spawns another copy of itself, which waits for carrier detect. Each init process spawned for a remote line also spawns getty when it detects a carrier signal on its port. (Note that this use of a second init process is unique to COHERENT.) init then waits for the termination of its child processes. If one of the getty processes terminates, init respawns it. If another process terminates, init waits to receive its return value, so the process does not become a ``zombie''. Logging In Users The following describes how init logs users in. As mentioned in the previous section, init invokes process getty for each enabled device on the system. getty and passes it as arguments the speed and the device upon which it should run. getty waits until someone tries to log in. Under COHERENT, getty sets the tty's line speed and local-edit characters and prompts the user to log in. It then locks the port, and invokes login with what the user has typed. At this point, the command login takes over the task of logging in the user. login first asks the user for his password. It then reads the encrypted password from file /etc/passwd. If the password consists of one asterisk `*', login then reads the encrypted password from file /etc/shadow. It then compares the retrieved password with what the user has typed. If the user has entered his password correctly, login executes various ``housekeeping'' tasks needed to get the user up and running under COHERENT. These include It records in file /usr/adm/utmp the fact of the user's logging in, which lets the system keep a running talley of who is logged into the system. For details on how login manages the task of logging in, see its entry in the Lexicon. As its last action, login invokes the program named in /etc/passwd. This usually is an interactive shell (i.e., sh or ksh), but can also be another program (e.g., uucico). If login invokes an interactive shell, it does so with the first character of its argv[0] set to `-', so that the shell knows that it is a login shell. (For example, if login invokes ksh, its argv[0] is -ksh.) The shell first executes file /etc/profile, then $HOME/.profile. Once these are executed, the shell displays its command-line prompt, and the user is ready to begin issuing commands to COHERENT When the login shell terminates, init removes its record from file /usr/adm/utmp. Then it reopens the appropriate terminal and invokes getty, as described above. The device is now ready to receive another login. Signals init accepts two signals. When it receives SIGQUIT, it re-reads /etc/ttys, spawns gettys on newly enabled devices, and stops gettys on disabled devices. The command kill quit 1 sends SIGQUIT to the init process. When init receives SIGHUP, it sends SIGKILL to every process and brings the system down to single-user mode. The command kill -1 1 sends SIGHUP to the init process. Files /dev/console -- Console terminal /dev/tty?? -- Terminal devices /etc/rc -- initialization command file /etc/brc -- Boot command file /etc/ttys -- Active terminals /etc/utmp -- Logged in users /usr/adm/wtmp -- Login accounting data /usr/spool/uucp/LCK..* -- Terminal locks See Also Administering COHERENT, getty, kill, ksh, login, sh, ttys