INIT(8) INIT(8) NAME init - process control initialization SYNOPSIS /etc/init DESCRIPTION _I_n_i_t is invoked inside UNIX as the last step in the boot procedure. It normally then runs the automatic reboot sequence as described in _r_e_b_o_o_t(8), and if this succeeds, begins multi-user operation. If the reboot fails, it commences single user operation by giving the super- user a shell on the console. It is possible to pass parameters from the boot program to _i_n_i_t so that single user operation is commenced immediately. When such single user operation is terminated by killing the single-user shell (i.e. by hitting ^D), _i_n_i_t runs _/_e_t_c_/_r_c without the reboot parameter. This command file performs housekeeping opera‐ tions such as removing temporary files, mounting file systems, and starting daemons. In multi-user operation, _i_n_i_t_’_s role is to create a process for each terminal port on which a user may log in. To begin such operations, it reads the file _/_e_t_c_/_t_t_y_s and executes a command for each terminal spec‐ ified in the file. This command will usually be _/_e_t_c_/_g_e_t_t_y. _G_e_t_t_y opens and initializes the terminal line, reads the user’s name and invokes _l_o_g_i_n to log in the user and execute 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 _i_n_i_t, which has been waiting for such an event, wakes up and removes the appropriate entry from the file _u_t_m_p, which records current users, and makes an entry in _/_u_s_r_/_a_d_m_/_w_t_m_p, which maintains a history of logins and logouts. The _w_t_m_p entry is made only if a user logged in successfully on the line. Then the appropriate terminal is reopened and _g_e_t_t_y is reinvoked. _I_n_i_t catches the _h_a_n_g_u_p signal (signal SIGHUP) and interprets it to mean that the file _/_e_t_c_/_t_t_y_s should be read again. The Shell process on each line which used to be active in _t_t_y_s but is no longer there is terminated; a new process is created for each added line; lines unchanged in the file are undisturbed. Thus it is possible to drop or add terminal lines without rebooting the system by changing the _t_t_y_s file and sending a _h_a_n_g_u_p signal to the _i_n_i_t process: use ‘kill -HUP 1.’ _I_n_i_t will terminate multi-user operations and resume single-user mode if sent a terminate (TERM) signal, i.e. ‘‘kill -TERM 1’’. If there are processes outstanding which are deadlocked (due to hardware or software failure), _i_n_i_t will not wait for them all to die (which might take for‐ ever), but will time out after 30 seconds and print a warning message. _I_n_i_t will cease creating new _g_e_t_t_y’s and allow the system to slowly die away, if it is sent a terminal stop (TSTP) signal, i.e. ‘‘kill -TSTP 1’’. A later hangup will resume full multi-user operations, or a ter‐ minate will initiate a single user shell. This hook is used by _r_e_b_o_o_t(8) and _h_a_l_t(8). _I_n_i_t_’_s role is so critical that if it dies, the system will reboot itself automatically. If, at bootstrap time, the _i_n_i_t process cannot be located, the system will loop in user mode at location 0x13. DIAGNOSTICS /etc/getty _g_e_t_t_y_a_r_g_s failing, sleeping. A process being started to service a line is exiting quickly each time it is started. This is often caused by a ringing or noisy terminal line. _I_n_i_t _w_i_l_l _s_l_e_e_p _f_o_r _3_0 _s_e_c_o_n_d_s_, _t_h_e_n _c_o_n_t_i_n_u_e _t_r_y_i_n_g _t_o _s_t_a_r_t _t_h_e _p_r_o_c_e_s_s_. WARNING: Something is hung (wont die); ps axl advised. A process is hung and could not be killed when the system was shutting down. This is usually caused by a process which is stuck in a device driver due to a persistent device error condition. FILES /dev/console, /dev/tty*, /etc/utmp, /usr/adm/wtmp, /etc/ttys, /etc/rc SEE ALSO login(1), kill(1), sh(1), ttys(5), crash(8V), getty(8), rc(8), reboot(8), halt(8), shutdown(8) 4th Berkeley Distribution May 22, 1986 INIT(8)