System Administration Guide

How to Shut Down a Server

  1. Become superuser.

  2. Find out if users are logged into the system.


    # who
    

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

  3. Shut down the system by using the shutdown command.


    # shutdown -iinit-state -ggrace-period -y 
    

    -iinit-state

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

    -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. 

  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): xxx
    
  6. After you have finished the system administration tasks, press Control-d to return to the default run system level.

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

    If the System Was Brought To ... 

    The SPARC System Prompt Should Be ... 

    The x86 System Prompt Should Be ... 

    Run level S (single-user state) 

    Run level 0 (power-down state) 

    ok or >

    type any key to continue

    Run level 3 (multiuser state with remote resources shared) 

    hostname console login:

    hostname console login:

Example--Bringing a SPARC System to Run Level S

In the following example, the shutdown and boot commands are used to bring a SPARC system to run level S (single-user state) in 3 minutes.


# who
root       console       May  7 08:35
# shutdown -i0 -g180 -y
 
Shutdown started.    Wed May  7 08:39:17 MDT 1997
 
Broadcast Message from root (console) on mars Wed May  7 08:39:18
The system will be shut down in 1 minute
Broadcast Message from root (console) on mars Wed May  7 08:39:50
The system will be shut down in 30 seconds
.
.
.
INIT: New run level: 0
The system is coming down.  Please wait.
syncing file systems... [7] [7] [5] done
Program terminated
ok boot -s
Booting from: sd(0,0,0) -s
SunOS Release 5.6 Version generic [UNIX(R) System V Release 4.0]
Copyright (c) 1983-1997, Sun Microsystems, Inc.
configuring network interfaces: le0.
Hostname: mars
 
INIT: SINGLE USER MODE
 
Type Ctrl-d to proceed with normal startup,
(or give root password for system maintenance): xxx
Entering System Maintenance Mode
# 

Example--Bringing a SPARC System to Run Level 0

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


# who
kryten     console      May  7 08:28
rimmer     pts/1        May  7 08:29    (starbug)
pmorph     pts/2        May  7 08:30    (bluemidget)
Send mail message to logged-in users
# shutdown -i0 -g300 -y
Shutdown started.    Wed May  7 09:49:01 PDT 1997
Broadcast Message from root (console) on pluto Wed May 7 09:46:58  
The system will be shut down in 3 minutes
.
 
.
 
.
INIT: New run level: 0
The system is coming down.  Please wait.
.
 
.
 
.
The system is down.
syncing file systems... [11] [9] [5] done
Program terminated
Type  help  for more information
ok 

See "How to Turn Off Power to All Devices" if you are bringing the system to run level 0 to turn off power to all devices.

Example--Rebooting a SPARC System to Run Level 3

In the following example, the shutdown command is used to reboot a SPARC system to run level 3 in 2 minutes without requiring additional confirmation.


# who
kryten     console      May  7 08:40
rimmer     pts/1        May  7 08:45    (starbug)
pmorph     pts/2        May  7 08:50    (bluemidget)
Send mail message to logged-in users
# shutdown -i6 -g120 -y
Shutdown started.    Wed May  7 09:52:06 PDT 1997
Broadcast Message from root (console) on pluto Wed May 7 09:46:58
The system will be shut down in 1 minute
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... [11] [9] [5] done
rebooting...
.
 
.
 
.
 
pluto console login:

Where to Go From Here

Regardless of the reason for shutting down the system, you'll probably want to return to run level 3 where all file resources are available and users can log in. See Chapter 8, Booting a SPARC System (Tasks), or Chapter 9, Intel: Booting a System (Tasks), for instructions on bringing a system back to a multiuser state.