Information Technology Reference
In-Depth Information
Changing the System Run Level
Occasionally, it is necessary to change the system run level. This includes
shutting down the system to add or remove hardware, performing back-
ups, preparing for an expected power outage, or preparing to physically
move the system. Table 2.9 lists the commands that change the system run
level from the command line.
Table 2.9
Commands Used to Change the System Run Level
Command
Path
Run Level(s)
Description
halt
/usr/sbin
0
Stops the processor(s)
init
/sbin
0,1,2,3,4,5,6,s
Processes control initialization
poweroff
/usr/sbin
5
Stops the processor(s) and powers off
the system (if possible)
reboot
/usr/sbin
6
Reboots the system
shutdown
/etc
0,1,5,6,s
Used for compatibility (symbolically
linked to /usr/sbin/shutdown )
shutdown
/usr/sbin
0,1,5,6,s
Changes system run level
telinit
/etc
0,1,2,3,4,5,6,s
Used for compatibility (symbolically
linked to /usr/sbin/init )
uadmin
/sbin
0,5,6
Used for administrative control
The halt(1M) command normally logs the shutdown to the system log,
writes a shutdown record to the system accounting file, performs a call to the
sync(1M) command to write out any pending information to the disks, and
halts the processor(s). The system and account logging along with disk sync-
ing can be prevented by the use of command-line arguments. The halt com-
mand changes to run level 0 but does not execute the rc scripts associated
with run level 0 as the shutdown(1M) and init(1M) commands do.
The init(1M) and telinit(1M) commands can be used to change to any of
the eight run levels. The commands identified in the /etc/inittab for each
run level are executed, and any running process not in /etc/inittab is sent
a SIGTERM and possibly a SIGKILL to cause them to terminate. For each run
level, an entry in the /etc/inittab runs the appropriate rc scripts to start
and stop processes.
The init command is unique in that it is the only command that can be used to
change to any system run level. Although all the commands can shutdown/reboot the
system (run levels 0, 1, 5 ,6 , s), the init command is the only one that can be used
to bring a system up from run levels s or 1 to run levels 2 or 3.
Search WWH ::




Custom Search