Shutting Down the System

Solaris software is designed to run continuously so that the electronic
mail and network software can work correctly. However, some system administration
tasks and emergency situations require that the system is shut down to a level
where it is safe to remove power. In some cases, the system needs to be brought
to an intermediate level, where not all system services are available, such
as the following:

System Shutdown Commands

The use of the init and shutdown
commands are the primary ways to shut down a system. Both commands perform
a cleanshutdown of the system,
which means that all file system changes are written to the disk, and all
system services, processes, and the operating system are terminated normally.

The following table describes the various shutdown commands and provides
recommendations for using them.

Table 12–1 Shutdown Commands

Command

Description

When To Use

shutdown

An executable shell script that calls
the init program to shut down the system. The system is
brought to run level S by default.

Recommended for servers running at
run level 3 because users are notified of the impending shut down. Also notified
are the systems that are mounting resources from the server that is being
shut down.

init

An executable that kills all active
processes and syncs the disks before changing run levels.

Recommended
for standalone systems when other users will not be affected. Provides a faster
system shutdown because users are not notified of the impending shutdown.

reboot

An executable that syncs the disks
and passes boot instructions to the uadmin system call,
which, in turn, stops the processor.

Not recommended. Use the init command
instead.

halt

An executable that syncs the disks
and stops the processor.

Not recommended because it doesn't execute the /etc/rc0 script. This script stops all processes, syncs the disks,
and unmounts any remaining file systems.

User Notification of System Down Time

When the shutdown command is initiated, a warning
followed by a final shutdown message is broadcast to all users who are currently
logged onto the system and all systems that are mounting resources from the
affected system.

For this reason, the shutdown command is recommended
over the init command when you need to shut down a server.
When you use either command, you might want to give users more notice by sending
them a mail message about any scheduled system shutdown.