428 lines
12 KiB
Plaintext
428 lines
12 KiB
Plaintext
.\" Copyright 1991 UNIX System Laboratories, Inc.
|
|
.\" Copyright 1989, 1990 AT&T
|
|
.nr X
|
|
.if \nX=0 .ds x} init 1M "Essential Utilities" "\&"
|
|
.TH \*(x}
|
|
.SH NAME
|
|
\f4init\f1, \f4telinit\f1 \- process control initialization
|
|
.SH SYNOPSIS
|
|
.nf
|
|
\f4/etc/init\f1 \f1[\f40123456SsQqabc\f1]
|
|
\f4/etc/telinit\f1 \f1[\f40123456SsQqabc\f1]
|
|
.fi
|
|
.SH DESCRIPTION
|
|
.SS init
|
|
\f4init\fP
|
|
is a general process spawner.
|
|
Its primary role is to create
|
|
processes from information stored in an \f4inittab\fP file
|
|
(see \f4inittab\fP(4)).
|
|
The default \f4inittab\fP file used is \f4/etc/inittab\fP; other
|
|
files can be specified using the \f4INITTAB\fP keyword in the
|
|
\f4system\fP file (see \f4system\fP(4)).
|
|
.PP
|
|
At any given time, the system is in one of eight possible run levels.
|
|
A run level is a software configuration of the system
|
|
under which only a selected group of processes exist.
|
|
The processes spawned by
|
|
\f4init\fP
|
|
for each of these run levels is defined in
|
|
\f4inittab\f1.
|
|
\f4init\fP
|
|
can be in one of eight run levels,
|
|
\f40\-6\f1
|
|
and \f4S\f1 or \f4s\f1
|
|
(run levels \f4S\f1 and \f4s\f1 are identical).
|
|
The run level changes when a privileged user runs
|
|
\f4/etc/init\f1.
|
|
This user-level
|
|
\f4init\fP
|
|
sends appropriate signals to the original \f4init\fP
|
|
(the one spawned by the operating system
|
|
when the system was booted) designating
|
|
the run level to which the latter should change.
|
|
.PP
|
|
The following are the arguments to \f4init\fP.
|
|
.TP 7
|
|
\f40\f1
|
|
Shut the machine down so it is safe to remove the power.
|
|
If it can, the machine will remove the power provided
|
|
the kernel power removal flag was previously set (as by the
|
|
command \f4/sbin/uadmin 256 9\fP).
|
|
.TP 7
|
|
\f41\f1
|
|
Put the system into system administrator
|
|
mode.
|
|
All filesystems are mounted.
|
|
Only a small set of essential kernel processes run.
|
|
This mode is for administrative tasks
|
|
such as installing optional utilities packages.
|
|
All files are accessible
|
|
and no users are logged in on the system.
|
|
.TP 7
|
|
\f42\f1
|
|
Put the system into multi-user state.
|
|
All multi-user environment terminal processes
|
|
and daemons are spawned.
|
|
.TP 7
|
|
\f43\f1
|
|
Start the remote file sharing processes and daemons.
|
|
Mount and advertise remote resources.
|
|
Run level \f43\f1 extends multi-user
|
|
mode and is known as the
|
|
remote-file-sharing state.
|
|
.TP 7
|
|
\f44\f1
|
|
Define a configuration for
|
|
an alternative multi-user environment.
|
|
This state is not necessary for normal system operations;
|
|
it is usually not used.
|
|
.TP 7
|
|
\f45\f1
|
|
Stop the
|
|
IRIX
|
|
system and enter firmware mode.
|
|
.TP
|
|
\f46\f1
|
|
Stop the
|
|
IRIX
|
|
system and reboot to the state defined by the
|
|
\f4initdefault\f1 entry in
|
|
\f4inittab\f1.
|
|
.TP 7
|
|
\f4a\f1,\f4b\f1,\f4c\f1
|
|
Process only those \f4inittab\f1 entries
|
|
for which the run level is set to
|
|
\f4a\f1, \f4b\f1, or \f4c\f1.
|
|
These are pseudo-states
|
|
that can be defined to run certain commands
|
|
but do not cause the current run level to change.
|
|
.TP 7
|
|
\f4Q\f1,\f4q\f1
|
|
Re-examine \f4inittab\f1.
|
|
.TP 7
|
|
\f4S\f1,\f4s\f1
|
|
Enter single-user mode.
|
|
When the system changes to this state
|
|
as the result of a command,
|
|
the terminal from which the command was executed
|
|
becomes the system console.
|
|
.IP
|
|
This is the only run level
|
|
that doesn't require the existence of
|
|
a properly formatted \f4inittab\f1 file.
|
|
If this file does not exist,
|
|
then by default the only legal run level that
|
|
\f4init\fP can enter is the single-user mode.
|
|
.IP
|
|
The set of filesystems mounted
|
|
and the list of processes killed
|
|
when a system enters system state \f4s\fP
|
|
are not always the same;
|
|
which filesystems are mounted
|
|
and which processes are killed
|
|
depends on the method used for putting the
|
|
system into state \f4s\fP
|
|
and the rules in force at your computer site.
|
|
The following paragraphs describe
|
|
state \f4s\fP in three circumstances: when
|
|
the system is brought up to \f4s\fP with \f4init\fP;
|
|
when the system is brought down (from another state)
|
|
to \f4s\fP with \f4init\fP;
|
|
and when the system is brought down to \f4s\fP
|
|
with \f4shutdown\fP.
|
|
.IP
|
|
When the system is brought up to \f4s\fP with \f4init\fP,
|
|
the only filesystem mounted is
|
|
\f4/\fP (root).
|
|
Filesystems for users' files are not mounted.
|
|
With the commands available on the mounted filesystems,
|
|
you can manipulate the filesystems
|
|
or transition to other system states.
|
|
Only essential kernel processes are kept running.
|
|
.IP
|
|
When the system is brought down to \f4s\fP with \f4init\fP,
|
|
all mounted filesystems remain mounted
|
|
and all processes started by \f4init\fP
|
|
that should be running only in multi-user mode are killed.
|
|
Because all login related processes are killed,
|
|
users cannot access the system while it's in this state.
|
|
In addition, any process for which
|
|
the \f4utmp\fP file has an entry is killed.
|
|
Other processes not started directly by \f4init\fP
|
|
(such as \f4cron\fP) remain running.
|
|
.IP
|
|
When you change to \f4s\fP with \f4shutdown\fP,
|
|
the system is restored to the state in which
|
|
it was running when you first booted the machine
|
|
and came up in single-user state,
|
|
as described above.
|
|
(The \f4powerdown\fP(1M) command takes the system
|
|
through state \f4s\fP on the way to
|
|
turning off the machine;
|
|
thus you can't use this command to put the system
|
|
in system state \f4s\fP.)
|
|
.PP
|
|
When an
|
|
IRIX
|
|
system is booted,
|
|
\f4init\fP
|
|
is invoked and the following occurs.
|
|
First,
|
|
\f4init\fP
|
|
looks in
|
|
\f4inittab\f1
|
|
for the
|
|
\f4initdefault\f1
|
|
entry
|
|
(see \f4inittab\f1(4)).
|
|
If there is one, \f4init\fP
|
|
usually uses the run level specified in that entry as the initial
|
|
run level for the system.
|
|
If there is no \f4initdefault\f1 entry in
|
|
\f4inittab\f1,
|
|
\f4init\fP
|
|
requests that the user enter a run level from the
|
|
virtual system console.
|
|
If an \f4S\f1 or \f4s\f1 is entered,
|
|
\f4init\fP takes the system to single-user state.
|
|
In the single-user state the virtual console terminal
|
|
is assigned to the user's terminal and
|
|
is opened for reading and writing.
|
|
The command
|
|
\f4/sbin/sulogin\f1
|
|
is invoked, which prompts the user for a root password (see \f4sulogin\fP(1M)),
|
|
and a message is generated on the physical console
|
|
saying where the virtual console has been relocated.
|
|
If \f4/bin/sulogin\fP cannot be found, then \f4init\fP attempts to launch
|
|
a shell: looking first for \f4/bin/csh\fP, then for \f4/sbin/sh\fP,
|
|
then finally for \f4/bin/ksh\fP.
|
|
Use either \f4init\fP or \f4telinit\fP to signal \f4init\f1
|
|
to change the run level of the system.
|
|
Note that if the shell is terminated (via an end-of-file),
|
|
\f4init\fP
|
|
only re-initializes to the single-user
|
|
state if the \f4inittab\f1 file does not exist.
|
|
.PP
|
|
If a
|
|
\f40\f1
|
|
through
|
|
\f46\f1
|
|
is entered, \f4init\fP
|
|
enters the corresponding run level.
|
|
Run levels
|
|
\f40\f1,
|
|
\f45\f1,
|
|
and
|
|
\f46\f1
|
|
are reserved states for shutting the system down.
|
|
Run levels
|
|
\f42\f1,
|
|
\f43\f1,
|
|
and
|
|
\f44\f1
|
|
are available as multi-user operating states.
|
|
.PP
|
|
If this is the first time since power up that
|
|
\f4init\fP
|
|
has entered a run level
|
|
other than single-user state,
|
|
\f4init\fP first scans
|
|
\f4inittab\f1
|
|
for \f4boot\f1 and \f4bootwait\f1 entries
|
|
(see \f4inittab\fP(4)).
|
|
These entries are performed before any other processing of
|
|
\f4inittab\f1
|
|
takes place, providing that the run level entered matches that of the entry.
|
|
In this way any special initialization of the
|
|
operating system, such as mounting
|
|
filesystems, can take place before users are allowed onto
|
|
the system.
|
|
\f4init\fP
|
|
then scans
|
|
\f4inittab\f1
|
|
and executes all other entries
|
|
that are to be processed for that run level.
|
|
.PP
|
|
To spawn each process in
|
|
\f4inittab\f1,
|
|
\f4init\fP
|
|
reads each entry and for each entry that should be
|
|
respawned, it forks a child process.
|
|
After it has spawned all of the processes specified by
|
|
\f4inittab\f1,
|
|
\f4init\fP
|
|
waits for one of its descendant processes to die,
|
|
a powerfail signal, or a
|
|
signal from another
|
|
\f4init\fP or \f4telinit\fP process
|
|
to change the system's run level.
|
|
When one of these conditions occurs,
|
|
\f4init\fP
|
|
re-examines
|
|
\f4inittab\f1.
|
|
New entries can be added to
|
|
\f4inittab\f1
|
|
at any time; however,
|
|
\f4init\fP
|
|
still waits for one of the above three conditions to occur
|
|
before re-examining \f4inittab\f1.
|
|
To get around this, the \f4init Q\fP
|
|
(or \f4init q\fP) command wakes \f4init\fP
|
|
to re-examine \f4inittab\f1 immediately.
|
|
Note, however, that if the \f4inittab\f1 has been edited to change baud-rates,
|
|
those changes only take effect when new \f4getty\fP processes are spawned
|
|
to oversee those ports.
|
|
Use \f4killall getty\fP to terminate all current \f4getty\fP processes,
|
|
then \f4init Q\fP to re-examine the \f4inittab\f1 and respawn them all
|
|
again with the new baud-rates.
|
|
.PP
|
|
When
|
|
\f4init\fP
|
|
comes up at boot time and whenever the system changes from
|
|
the single-user state to another run state, \f4init\f1 sets the
|
|
\f4ioctl\fP(2)
|
|
states of the virtual console to those modes saved in the
|
|
file \f4/etc/ioctl.syscon\f1.
|
|
This file is written by \f4init\fP whenever the
|
|
single-user state is entered.
|
|
.br
|
|
.ne4
|
|
.PP
|
|
When a run level change request is made
|
|
\f4init\fP
|
|
sends the warning signal (\f4SIGTERM\fP) to all processes that are
|
|
undefined in the target run level.
|
|
\f4init\fP
|
|
waits five seconds before forcibly terminating these processes via
|
|
the kill signal (\f4SIGKILL\fP).
|
|
.PP
|
|
When \f4init\fP
|
|
receives a signal telling it that a
|
|
process it spawned has died, it records the fact
|
|
and the reason it died
|
|
in
|
|
\f4/var/adm/utmp\f1 and
|
|
\f4/var/adm/wtmp\f1
|
|
if it exists (see
|
|
\f4who\f1(1)).
|
|
A history of the processes spawned is kept in
|
|
\f4/var/adm/wtmp\f1.
|
|
.PP
|
|
If \f4init\fP receives a
|
|
\f4powerfail\f1
|
|
signal
|
|
\f1(\f4SIGPWR\f1)
|
|
it scans
|
|
\f4inittab\f1
|
|
for special entries of the type
|
|
\f4powerfail\f1
|
|
and
|
|
\f4powerwait\f1.
|
|
These entries are
|
|
invoked (if the run levels permit) before any further processing
|
|
takes place.
|
|
In this way
|
|
\f4init\fP
|
|
can perform various cleanup and recording functions
|
|
during the powerdown of the operating system.
|
|
.SS telinit
|
|
\f4telinit\fP,
|
|
which is linked to
|
|
\f4/sbin/init\f1,
|
|
is used to direct the actions of
|
|
\f4init\fP.
|
|
It takes a one-character argument and signals \f4init\fP
|
|
to take the appropriate action.
|
|
.SH FILES
|
|
\f4/etc/inittab\f1 default \f4inittab\fP file
|
|
.br
|
|
\f4/var/adm/utmp\f1
|
|
.br
|
|
\f4/var/adm/wtmp\f1
|
|
.br
|
|
\f4/etc/TIMEZONE\f1
|
|
.br
|
|
\f4/etc/ioctl.syscon\f1
|
|
.br
|
|
\f4/dev/console\f1
|
|
.SH "SEE ALSO"
|
|
getty(1M),
|
|
killall(1M),
|
|
login(1),
|
|
powerdown(1M),
|
|
sh(1),
|
|
shutdown(1M),
|
|
stty(1),
|
|
sulogin(1M),
|
|
uadmin(1M),
|
|
who(1),
|
|
kill(2),
|
|
inittab(4),
|
|
system(4),
|
|
timezone(4),
|
|
utmp(4),
|
|
termio(7).
|
|
.SH "DIAGNOSTICS"
|
|
If \f4init\fP
|
|
finds that it is respawning an entry from the
|
|
\f4inittab\f1 file
|
|
more than ten times in two minutes, it assumes that
|
|
there is an error in the command string in the entry,
|
|
and generates an error message on the system console.
|
|
It then refuses to respawn this entry until either
|
|
five minutes has elapsed or it receives a signal from
|
|
a user-spawned
|
|
\f4init\fP
|
|
or
|
|
\f4telinit\f1.
|
|
This prevents
|
|
\f4init\fP
|
|
from consuming system resources when someone makes a
|
|
typographical error in the
|
|
\f4inittab\fP
|
|
file or a program is removed that is referenced in
|
|
\f4inittab\f1.
|
|
.PP
|
|
When attempting to boot the system, failure of
|
|
\f4init\fP
|
|
to prompt for a new run level may be because
|
|
the virtual system console
|
|
is linked to a device other than the physical system console.
|
|
.SH NOTES
|
|
\f4init\fP
|
|
and
|
|
\f4telinit\fP
|
|
can be run only by a privileged user.
|
|
.PP
|
|
The
|
|
\f4S\f1
|
|
or
|
|
\f4s\f1
|
|
state must not be used indiscriminately in the \f4inittab\f1 file.
|
|
A good rule to follow when modifying this file is to avoid adding this
|
|
state to any line other than the \f4initdefault\f1.
|
|
.P
|
|
If a default state is not specified in the \f4initdefault\fP
|
|
entry in \f4inittab\fP,
|
|
state \f46\fP is entered.
|
|
Consequently, the system loops; that is, it goes to firmware
|
|
and reboots continuously.
|
|
.P
|
|
If the \f4utmp\fP file cannot be created when booting the system,
|
|
the system boots to state \f4s\fP regardless of
|
|
the state specified in the \f4initdefault\fP entry in
|
|
the \f4inittab\fP file.
|
|
.P
|
|
In the event of a file table overflow condition, \f4init\f1 uses a
|
|
file descriptor associated with the \f4inittab\f1 file that it retained
|
|
from the last time it accessed that file.
|
|
This prevents \f4init\f1 from going into single user mode when it
|
|
cannot obtain a file descriptor to open the \f4inittab\f1 file.
|
|
.P
|
|
The environment for \f4init\fP and all processes directly started
|
|
by is set initially from a table that is builtin, and then by
|
|
parsing the file \f4/etc/TIMEZONE\fP.
|
|
Lines in that file that are
|
|
too long are ignored.
|