4.4BSD/usr/src/old/init/init.8

Compare this file to the similar file:
Show the results in this format:

.\" Copyright (c) 1980, 1991 Regents of the University of California.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\"    must display the following acknowledgement:
.\"	This product includes software developed by the University of
.\"	California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\"    may be used to endorse or promote products derived from this software
.\"    without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\"     @(#)init.8	6.4 (Berkeley) 4/29/91
.\"
.Dd April 29, 1991
.Dt INIT 8
.Os BSD 4
.Sh NAME
.Nm init
.Nd process control initialization
.Sh SYNOPSIS
.Nm init
.Sh DESCRIPTION
The
.Nm init
program
is the last stage of the boot process.
It normally runs the automatic reboot sequence as described in
.Xr reboot 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.
The
.Nm init
program
may be passed parameters
from the boot program to
prevent the system from going multi-user and to instead execute
a single user shell with out starting the normal daemons.
The system is then quiescent for maintenance work and may
later be made it go multi-user by killing the
the single-user shell (with ^D).
This
causes
.Nm init
to run the
.Pa /etc/rc
start up command file without the reboot parameter.
.Pp
In multi-user operation, 
.Nm init
maintains
processes for the terminal ports found in the file
.Xr ttys 5.
.Nm Init
reads this file, and executes the command found in the second field.
This command is usually
.Xr getty 8 ;
.Xr getty
opens and initializes the tty line
and
executes the
.Xr login
program.
The
.Xr login
program, when a valid user logs in,
exectutes a shell for that user.  When this shell
dies, either because the user logged out
or an abnormal termination occured (a signal),
the
.Nm init
program wakes up, deletes the user
from the
.Xr utmp 5
file of current users and records the logout in the
.Xr wtmp
file.
The cycle is
then restarted by
.Nm init
excuting a new
.Xr getty
for the line.
.Pp
Lines may be added or deleted from the
.Xr ttys
file without a reboot by sending the signal
.Dv SIGHUP
to
.Nm init
with the command
.Dq Li "kill -HUP 1"
Upon receipt of this signal,
.Nm init
re-reads the
.Xr ttys
file.
Engaged (in use) ports
are not disturbed,
and if an engaged port has been deleted from the
file, it will only become inactive after the engaging process has
terminated (the user has logged off).
If a port is inactive (only a
.Xr getty
or terminated processes are attached to it)
.Nm init
elimiates these processes.
For these ports and any new ports, for which a command is found
in the
.Xr ttys
file,
.Nm init
executes a new
.Xr getty .
.Pp
.Nm Init
will terminate multi-user operations and resume single-user mode
if sent a terminate
.Pq Dv TERM
signal, for example,
.Dq Li "kill \-TERM 1" .
If there are processes outstanding which are deadlocked (due to
hardware or software failure),
.Xr init
will not wait for them all to die (which might take forever), but
will time out after 30 seconds and print a warning message.
.Pp
.Nm Init
will cease creating new
.Xr getty Ns 's
and allow the system to slowly die away, if it is sent a terminal stop
.Pq Dv TSTP
signal, i.e.
.Dq Li "kill \-TSTP 1" .
A later hangup will resume full
multi-user operations, or a terminate will initiate a single user shell.
This hook is used by
.Xr reboot 8
and
.Xr halt 8 .
.Pp
The role of
.Nm init
is so critical that if it dies, the system will reboot itself
automatically.
If, at bootstrap time, the
.Xr init
process cannot be located, the system will loop in user mode at location
0x13.
.Sh DIAGNOSTICS
.Bl -diag
.It "/usr/libexec/getty \\*(eMgettyargs\\*(fP 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.
.Em "Init will sleep for 30 seconds" ,
.Em "then continue trying to start the process" .
.Pp
.It "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.
.El
.Sh FILES
.Bl -tag -width /var/log/wtmp -compact
.It Pa /dev/console
System console device.
.It Pa /dev/tty*
Terminal ports found in
.Xr ttys .
.It Pa /var/run/utmp
Record of Current users on the system.
.It Pa /var/log/wtmp
Record of all logins and logouts.
.It Pa /etc/ttys
The terminal initialization information file.
.It Pa /etc/rc
System startup commands.
.El
.Sh SEE ALSO
.Xr login 1 ,
.Xr kill 1 ,
.Xr sh 1 ,
.Xr ttys 5 ,
.Xr crash 8 ,
.Xr getty 8 ,
.Xr rc 8 ,
.Xr reboot 8 ,
.Xr halt 8 ,
.Xr shutdown 8
.Sh HISTORY
A
.Nm
command appeared in
.At v6 .