Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

System Administration Guide: Basic Administration
Previous Next

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 cases include the following:

  • Adding or removing hardware

  • Preparing for an expected power outage

  • Performing file system maintenance, such as a backup

For a complete list of system administration tasks that require a system shutdown, see Chapter 9, Shutting Down and Booting a System (Overview).

For information on using your system's power management features, see the pmconfig(1M) man page.

System Shutdown Commands

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

The use of a system's Stop key sequence or turning a system off and then on are not clean shutdowns because system services are terminated abruptly. However, sometimes these actions are needed in emergency situations. For instructions on system recovery techniques, see Chapter 12, Booting a Solaris System (Tasks) andChapter 14, Managing the Solaris Boot Archives (Tasks).


Note - On x86 systems that are running at least the Solaris 10 6/06 release, pressing and releasing the power button initiates a clean system shutdown. This method is equivalent to using the init 5 command.


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

Table 10-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 operating at run level 3 because users are notified of the impending shutdown. 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 synchronizes the disks before changing run levels.

Recommended for stand-alone 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 synchronizes the disks and passes boot instructions to the uadmin system call. In turn, this system call stops the processor.

The init command is the preferred method.

halt, poweroff

An executable that synchronizes the disks and stops the processor.

Not recommended because it doesn't shutdown all processes, and unmount any remaining file systems. Stopping the services, without doing a clean shutdown, should only be done in an emergency or if most of the services are already stopped.

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 in to the system and all systems that are mounting resources from the affected system.

For this reason, the shutdown command is preferred instead of 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.

Use the who command to determine which users on the system need to be notified. This command is also useful for determining a system's current run level. For more information, see Determining a System's Run Level and the who(1) man page.

How to Determine Who Is Logged in to a System

  1. Log into the system to be shut down.
  2. Display all users who are logged in to the system.
    $ who
Example 10-1 Determining Who Is Logged in to a System

The following example shows how to display who is logged in to the system.

$ who
holly       console      May  7 07:30
kryten      pts/0        May  7 07:35   (starlite) 
lister      pts/1        May  7 07:40   (bluemidget)
  • Data in the first column identifies the user name of the logged-in user

  • Data in the second column identifies the terminal line of the logged-in user

  • Data in the third column identifies the date and time that the user logged in

  • Data in the forth column, if present, identifies the host name if a user is logged in from a remote system

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

How to Shut Down a Stand-Alone System

Use this procedure when you need to shut down a stand-alone system.

  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. Shut down the system.
    # init 5

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

    • Alternately, you can use the uadmin command to shut down the system.
      # uadmin 2 0
    • If you have an x86 based system that is running at least the Solaris 10 6/06 release, you can press and release the power button to initiate a clean system shutdown and turn off the system. This functionality is equivalent to using the init 5 command to shut down a system. For more information, see What's New in Shutting Down and Booting a System.
  3. Use the following table to verify that the system is at the run level that you specified in the init command.

    Specified Run Level

    SPARC Based System Prompt

    x86 Based System Prompt

    S (single-user level)

    #

    #

    2 (multiuser level)

    #

    #

    0 (power-down level)

    ok or >

    Press any key to reboot

    3 (multiuser level with NFS resources shared)

    hostname console login:

    hostname console login:

Example 10-5 Using the uadmin command to Shut Down a System
# uadmin 2 0
syncing file systems... done
Program terminated
Example 10-6 Bringing a Stand-Alone System to Run Level 0

In this example, the init command is used to bring an x86 based stand-alone system to the level where it is safe to turn off power.

# init 0
#
INIT: New run level: 0
The system is coming down.  Please wait.
.
 
.
 
.
The system is down.
syncing file systems... [11] [10] [3] done
Press any key to reboot

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-7 SPARC: Bringing a Stand-Alone System to Run Level S

In this example, the init command is used to bring a SPARC based stand-alone system to run level S (single-user level).

# init s
#
INIT: New run level: S
The system is coming down for administration.  Please wait.
Unmounting remote filesystems: /vol nfs done.
Print services stopped.
syslogd: going down on signal 15
Killing user processes: done. 

SINGLE USER MODE

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

Regardless of why you shut down the 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).

Previous Next

 
 
  Published under the terms fo the Public Documentation License Version 1.01. Design by Interspire