System Administration Guide: Basic Administration

ProcedureHow to Shut Down a Server

  1. Become superuser or assume an equivalent role.

    Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services.

  2. Find out if users are logged in to the system.


    # who
    

    A list of all logged-in users is displayed. You might want to send mail or broadcast a message to let users know that the system is being shut down.

  3. Shut down the system.


    # shutdown -iinit-level -ggrace-period -y
    
    -iinit-level

    Brings the system to an init level that is different from the default of S. The choices are 0, 1, 2, 5, and 6.

    Run levels 0 and 5 are reserved states for shutting the system down. Run level 6 reboots the system. Run level 2 is available as a multi-user operating state.

    -ggrace-period

    Indicates a time (in seconds) before the system is shut down. The default is 60 seconds.

    -y

    Continues to shut down the system without intervention. Otherwise, you are prompted to continue the shutdown process after 60 seconds.

    For more information, see the shutdown(1M) man page.

  4. If you are asked for confirmation, type y.


    Do you want to continue? (y or n): y
    

    If you used the shutdown -y command, you will not be prompted to continue.

  5. Type the superuser password, if prompted.


    Type Ctrl-d to proceed with normal startup,
    (or give root password for system maintenance): xxxxxx
    
  6. After you have finished the system administration tasks, press Control-D to return to the default system run level.

  7. Use the following table to verify that the system is at the run level that you specified in the shutdown command.

    Specified Run Level 

    SPARC Based System Prompt 

    x86 Based System Prompt 

    S (single-user level) 

    0 (power-down level) 

    ok or >

    Press any key to reboot

    Run level 3 (multiuser level with remote resources shared) 

    hostname console login:

    hostname console login:


Example 10–2 SPARC: Bringing a Server to Run Level S

In the following example, the shutdown command is used to bring a SPARC based system to run level S (single-user level) in three minutes.


# who
root   console      Jun 14 15:49    (:0)

# shutdown -g180 -y

Shutdown started.    Mon Jun 14 15:46:16 MDT 2004

Broadcast Message from root (pts/4) on venus Mon Jun 14 15:46:16...
The system venus will be shut down in 3 minutes .
.
.
Broadcast Message from root (pts/4) on venus Mon Jun 14 15:46:16...
The system venus will be shut down in 30 seconds .
.
.
INIT: New run level: S
The system is coming down for administration.  Please wait.
Unmounting remote filesystems: /vol nfs done.
Shutting down Solaris Management Console server on port 898.
Print services stopped.
Jun 14 15:49:00 venus syslogd: going down on signal 15
Killing user processes: done.

Requesting System Maintenance Mode
SINGLE USER MODE

Root password for system maintenance (control-d to bypass): xxxxxx
single-user privilege assigned to /dev/console.
Entering System Maintenance Mode
#


Example 10–3 SPARC: Bringing a Server to Run Level 0

In the following example, the shutdown command is used to bring a SPARC based system to run level 0 in 5 minutes without requiring additional confirmation.


# who
root       console       Jun 17 12:39
userabc		 pts/4        Jun 17 12:39   (:0.0)
# shutdown -i0 -g300 -y
Shutdown started.    Thu Jun 17 12:40:25 MST 2004

Broadcast Message from root (console) on pretend Thu Jun 17 12:40:25...
The system pretend will be shut down in 5 minutes 
.
.
.
Changing to init state 0 - please wait
# 
INIT: New run level: 0
The system is coming down.  Please wait.
System services are now being stopped.
.
.
.
The system is down.
syncing file systems... done
Program terminated
Type  help  for more information
ok 

If you are bringing the system to run level 0 to turn off power to all devices, see How to Turn Off Power to All Devices.



Example 10–4 SPARC: Rebooting a Server to Run Level 3

In the following example, the shutdown command is used to reboot a SPARC based system to run level 3 in two minutes. No additional confirmation is required.


# who
root   		console      Jun 14 15:49    (:0)
userabc    pts/4        Jun 14 15:46    (:0.0)
# shutdown -i6 -g120 -y
Shutdown started.    Mon Jun 14 15:46:16 MDT 2004

Broadcast Message from root (pts/4) on venus Mon Jun 14 15:46:16...
The system venus will be shut down in 2 minutes 


Changing to init state 6 - please wait
# 
INIT: New run level: 6
The system is coming down.  Please wait.
.
.
.
The system is down.
syncing file systems... done
rebooting...
.
.
.
venus console login:

See Also

Regardless of why you shut down a system, you'll probably want to return to run level 3 where all file resources are available and users can log in. For instructions on bringing a system back to a multiuser level, see Chapter 12, Booting a Solaris System (Tasks).