Information Technology Reference
In-Depth Information
The
poweroff(1M)
command changes the system to run level 5. Normally, it
logs the shutdown to the system log, writes a shutdown record to the system
accounting file, performs a call to
sync(1M)
to write out any pending infor-
mation to the disks, and halts the processor(s). If possible, it then shuts off
the power. The
poweroff
command is equivalent to the
init 5
command.
The
reboot(1M)
command changes the system to run level 6. Normally, it
logs the reboot to the system log, writes a shutdown record to the system
accounting file, performs a call to the
sync
to write out any pending infor-
mation to the disks, and initiates a multiuser reboot (but does not execute the
rc
scripts associated with run level 0).
The
reboot
command is unique in that it can pass arguments to the OpenBoot
boot
command using the
--
argument. For example, the command
reboot -- -rv
passes
the
-rv
command-line arguments to the OpenBoot
boot
command, which are then
passed to the kernel. In this case, the
r
causes the system to be reconfigured (that
is, all devices are probed and the device nodes are rebuilt) and the
v
enables verbose
mode.
The
shutdown
command (under the /usr/sbin and /etc directories) pro-
vides a grace period and warning message capability along with executing the
appropriate rc scripts. The shutdown command can be used to change to
run levels, 0, 1, 5, 6, and s.
The
shutdown
command without any command-line arguments will result in
a one-minute grace period with a warning message at 1 minute, 30 seconds,
and now. The
shutdown
command will prompt for confirmation to continue
before the
“shutdown now”
message is broadcast and the run level change
continues. The system is then changed to run level
s
.
The
uadmin(1M)
command provides basic administrative functions, such as
shutting down or rebooting a system. Typically, it is called by various system
administration procedures and not intended for general use.
The
who -r
command can be used to determine the current run level of the system
and the date on which the change to that run level occurred.
The init and shutdown Commands
The most frequently used commands to change system run level are the
init
and
shutdown
commands. Both use the
/etc/inittab
to determine the
processes to start and stop, and both execute the appropriate
rc
scripts on the
basis of system run level.