INIT, TELINIT(8,C) AIX Commands Reference INIT, TELINIT(8,C)
-------------------------------------------------------------------------------
init, telinit
PURPOSE
Initializes the system.
SYNTAX
/etc/init --------------------|
|- runlevel -|
|---- q ----|
|---- s ----|
|---- Q ----|
|---- S ----|
|---- -m ----|
+---- -M ----+
/etc/telinit --------------------|
|- runlevel -|
|---- a -----|
|---- b -----|
|---- c -----|
|---- q -----|
|---- s -----|
|---- Q -----|
|---- S -----|
|---- m -----|
+---- M -----+
Note: This command does not have MBCS support.
DESCRIPTION
The init command is a general process spawner. Its primary role is to create
processes from stanzas stored in the file /etc/inittab. This file usually has
the init command spawn gettys on each line so that a user can log in. The init
command also controls autonomous processes required by a particular system.
The telinit command, which is linked to the /etc/init file, is used to direct
the actions of the init command. For more information on telinit, see page
4.
The init command considers the system to be in a certain runlevel at any given
time. A runlevel can be viewed as a software configuration of the system where
each configuration allows only a selected group of processes to exist. The
processes spawned by the init command for each of these runlevels is defined in
the file inittab. The init command can be in a runlevel, from 0-6 and M, m, S,
Processed November 8, 1990 INIT, TELINIT(8,C) 1
INIT, TELINIT(8,C) AIX Commands Reference INIT, TELINIT(8,C)
or s. The runlevel is changed by having the superuser run /etc/telinit. This
user-spawned init command sends appropriate signals to the init daemon command
spawned by the operating system when the system was rebooted, telling it to
which runlevel to change.
The runlevels in the default /etc/inittab file are as follows:
0 Halt the system. This runlevel should be used to bring down the system
when it is going to be powered off. This level unmounts the file
systems, leaves the cluster, kills all processes, and then halts the
system.
1 Allow access to the system without any other activity. When entered
from the single-user level, runlevel 1 starts the processes that allow
users to use their terminals (see "getty"). If runlevel 1 is entered
from any other state, no other processes are terminated.
2 Enter multi-user mode. This runlevel is used to bring up the system so
that everyone can use it. During this transition, daemons are started,
the cluster is joined, and file systems are checked and mounted. When
successfully concluded, this state now enters runlevel 4 (via init 4).
3 Prepare the system for maintenance. This runlevel is used to quiesce
the system. The file systems are unmounted. All processes are killed
and the system enters single-user level (via init s).
4 Enable normal operations; allows terminal activity to begin.
Note: Runlevels 5 and 6 are not used in the default /etc/inittab file.
Normally you should use only runlevels 0, 2, and 3. Runlevels 0 and 3 are used
to bring down the system for maintenance activity. Runlevel 2 is used to bring
up the system for normal usage.
The init command is invoked inside the system as the last step in the boot
procedure. The first thing the init command does is to look for the file
/etc/inittab and see if it contains a stanza with an action of initdefault. If
initdefault exists, the init command uses the level specified in that stanza as
the initial runlevel. If initdefault or inittab do not exist, init requests
that you enter a runlevel from the system virtual console, /dev/syscon. If an
M, m, S or s is entered the init command enters Single-User level. This is the
only runlevel that does not require the existence of a properly formatted
inittab file. If the file /etc/inittab does not exist, the only runlevel that
the init command can enter is the Single-User level. In Single User level, the
system virtual console /dev/syscon is opened for reading and writing, and the
command /etc/sushell is invoked. To exit Single-User level, one of two options
can be used.
o If the shell is terminated, the init command prompts for a new runlevel.
o The init or telinit command can signal the init command and force a new
runlevel.
Processed November 8, 1990 INIT, TELINIT(8,C) 2
INIT, TELINIT(8,C) AIX Commands Reference INIT, TELINIT(8,C)
When attempting to boot the system, failure of the init command to prompt for a
runlevel may be because the device /dev/syscon is linked to a device other than
the physical system unit (/dev/systty). If this occurs, you must boot the
installation/maintenance system, mount the system's /local file system, and
issue the command:
ln /local/dev/systty /local/dev/syscon
When the init command prompts for a new runlevel, you can enter 0-6, M, m, S or
s. If you enter M, m, s, or S, the init command operates as described in
Single-User level with the additional result that the device /dev/syscon is
linked to the user's terminal line, thus making it the virtual system console.
A message is generated on the physical console, /dev/systty, identifying where
the virtual terminal is located.
When the init command is started initially and whenever it switches out of
Single-User level to the normal run state, it sets the ioctl system-call states
of the virtual console /dev/syscon to the modes saved in the file
/etc/ioctl.console. This file is written by the init command whenever
Single-User level is entered. If this file does not exist when the init
command reads it, a message prints and the default settings are assumed.
If 0-6 is entered, the init command enters the corresponding runlevel. Any
other input is rejected and the user is prompted for a runlevel. If this is
the first time the init command has entered a runlevel other than the
Single-User level, the init command scans the inittab file for stanzas with
action values of boot or bootwait. These stanzas are processed, providing
their level matches runlevel, before any normal processing of the inittab file
takes place. In this way, any special initialization of the operating system,
such as mounting file systems, can take place before users are allowed onto the
system. The inittab file is then scanned to find entries that are to be
processed for that runlevel.
In the multi-user environment, the inittab file is usually set up so that the
init command creates a process for each terminal on the system. The init
command controls the number of login processes that are active at one time.
For terminal processes, ultimately the shell terminates because of the
end-of-file, either typed explicitly or generated as the result of hanging up.
When init receives a signal telling it that the process that it spawned has
died, init records this along with the reason in /etc/utmp and /usr/adm/wtmp.
A history of the processes spawned is kept in /usr/adm/wtmp if the file exists.
To spawn each process in the inittab file, the init command reads each entry
stanza and for each stanza which should be respawned, it forks a child process.
After it has spawned all processes specified in the file inittab, the init
command waits for one of its descendant processes to die, a powerfail signal,
or until it is signaled by another init command or telinit command to change
the system runlevel. When one of these three conditions occurs, init
re-examines the inittab file. New stanzas can be added to inittab at any time.
However, init still waits for one of the above three conditions to occur. To
Processed November 8, 1990 INIT, TELINIT(8,C) 3
INIT, TELINIT(8,C) AIX Commands Reference INIT, TELINIT(8,C)
provide for instantaneous response, the init Q or init q command causes init to
re-examine the inittab file.
If the init command receives the powerfail signal, SIGPWR, and is not in the
Single-User level, it scans the file inittab for special powerfail stanzas.
These stanzas are invoked, if the runlevel permits, before any further
processing takes place. In this way, the init command performs various cleanup
and recording functions whenever the operating system experiences a power
failure. The powerfail stanzas should not use devices that must first be
initialized after a power failure.
When the init command is requested to change the runlevel, via the telinit,
command the init command sends the warning signal, SIGTERM, to all processes
that are undefined in the target runlevel. The init command waits 20 seconds
before forcibly terminating these processes via the kill signal, SIGKILL.
If the init command finds that it is continuously respawning a stanza from the
file /etc/inittab more than 10 times in two minutes, it assumes that there is
an error in the command string, generates an error message to the system
console, and refuses to respawn this stanza for five minutes or until it
receives a signal from a user telinit. This prevents init from using excessive
system resources when a typographical error occurs in inittab or a program is
removed that is referenced by inittab.
The telinit command can only be used by someone with superuser authority or a
member of the system group. The runlevel parameter corresponds to a
configuration of processes in the system. For example, if the system is in
runlevel 1, only those /etc/inittab entries with a "level=1" line are
processed. When telinit is used to change the runlevel, all processes which do
not have the specified runlevel are sent a kill signal after a 20-second grace
period. You can change the actions of the telinit command with the following
runlevel options:
0-6 Tells the init command to process only those /etc/inittab file entries
that have the specified runlevel set.
a, b, c Tells the init command to process only those /etc/inittab file entries
that have the a, b, or c runlevel set.
Q, q Tells the init command to re-examine /etc/inittab.
s, S, m, M
Tells init to enter the Single User level. Warning: When the Single
User level change is effected, the virtual system console
(/dev/syscon) changes to the terminal from which the command was
executed.
ENVIRONMENTS
Because the init command is the ultimate ancestor of every process on the
system, its environment parameters are inherited by every process. As part of
its initialization sequence, the init command reads the file /etc/environment
Processed November 8, 1990 INIT, TELINIT(8,C) 4
INIT, TELINIT(8,C) AIX Commands Reference INIT, TELINIT(8,C)
and copies any assignments found in that file into the environment passed to
all of its subprocesses. It treats the umask differently. If it is assigned a
reasonable octal value, the init command does a umask system call for the
specified value, rather than passing the value in the environment. Similarly,
if filesize is specified, the init command issues a ulimit call with the given
size as the argument.
FILES
/etc/inittab
/etc/utmp
/usr/adm/wtmp
/etc/ioctl.syscon
/dev/syscon
/dev/systty
RELATED INFORMATION
See the following commands: "getty," "login," "pstart, penable, pshare,
pdelay," "sh, Rsh," and "who."
See the kill system call and the inittab and utmp file formats in AIX Operating
System Technical Reference.
Processed November 8, 1990 INIT, TELINIT(8,C) 5