Solaris Handbook for Sun Peripherals

Shut Down the System

Unless you are adding a hot-pluggable peripheral, you must shut down the operating system and power off the system before the new peripheral is installed.

Before you shut down the operating system, you should stop any applications and close any open files on the system.

When preparing to shut down a system, you need to determine which of the following shutdown commands is appropriate for the system and the task at hand:


Note -

See Table 1-2 for a definition of each shutdown command.


These commands initiate shut down procedures, kill all running processes, write data to disk, and shut down the system software to the appropriate run level.


Note -

init and shutdown are the two most reliable ways to shut down a system because they use rc scripts to kill running processes and shut down the system with minimal data loss. The halt and reboot commands do not run the rc scripts properly and are not the preferred method for shutting down the system.



Note -

For more information about rc scripts, see the System Administration Guide, "Boot Files and Run Levels."


The table below describes each of the shutdown commands. For shutdown procedures refer to "To Shut Down a Single-User System Using init" and"To Shut Down a Multiuser System Using shutdown".

Table 1-2 Shutdown Commands

Command 

Function 

init n

Use the init command to shut down a system when there are no users who need to be warned. init can also be used to change run levels. For example, use init 6 to reboot a system. See "Run Levels"" for more information.

shutdown

Use the shutdown command when shutting down a system with multiple users. The shutdown command sends a warning message to all users who are logged in, waits for 60 seconds (the default), and then shuts down the system to single-user state. See the procedure shown on "To Shut Down a Multiuser System Using shutdown".

halt

Use the halt command when the system must be stopped immediately and it is acceptable not to warn any current users. The halt command shuts down the system without any delay. It does not warn any other users on the system. It does not run any customized shutdown scripts from the rc directories.

reboot

Use the reboot command to shut down a single-user system and bring it into multiuser state. reboot does not warn other users on the system. It does not run any customized shutdown scripts from the rc directories.

Run Levels

The run level defines what services and resources are available to users. A system can be in only one run level at a time. See the table below for a description of the various run levels.

Run level numbers are used with the init and shutdown commands to control system services. Use the init command to shut down a system that does not have multiple users or clients. In addition, use the init command to change run levels. You can also specify the run level as an argument to the shutdown command with the -i option.

Table 1-3 Run Levels

Run Level 

System State 

Description 

Monitor mode 

The operating system is shut down. The system displays the ok prompt. It is safe to turn off system power.

Multiuser mode 

The operating system is fully booted; all required processes are started to support multiple users, network access, file systems, event logging, and so on. It is not safe to turn off system power. 

Automatic power-off 

The operating system is shut down and power is automatically turned off (on supported systems only). 

Reboot  

The operating system is brought to run level 0 and then to the default run level as specified in the /etc/inittab file (typically run level 3).

s or S or 1 

Single-user mode 

The operating system is in maintenance mode. In this mode, only a few processes are started for basic system functionality. Only the /, /usr, and /proc file systems are mounted, and no nfs file systems are shared. Only superuser is allowed to log in.

It is not safe to turn off system power. 

Use the who command to determine your run level.

The following example shows a system that is in multiuser mode (run level 3).


# who -r
. run-level 3 Apr 24 10:44 S 0 S


Note -

who is not a valid command when you are at run level 0.


To Shut Down a Single-User System Using init

This section describes how to shut down a single-user system.


Note -

init does not send a warning message to users.



Note -

Be sure to prepare the system first. Refer to "To Prepare the System" for more information.


  1. Become superuser.

  2. Stop all applications and close any open files on the system.

  3. Shut down the system.


    # init 0
    

    This command writes data to the disk, kills all active processes, brings the system down to the monitor mode, and displays the ok prompt.

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


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

  5. If you are installing a new SCSI device continue with Step 6. If you are installing a new card continue with instructions in Chapter 5, Setting Up an Option Card".

  6. Reset the SCSI bus with the reset command followed by a Stop-A:


    ok reset 
    Immediately press <Stop-a> once you see the banner on your screen.

    The reset command (reset-all on some systems) resets the SCSI bus and memory to ensure a effective probe-scsi search. The Stop-A key sequence interrupts the reboot process that normally results from the reset command. This way you remain at run level 0 to perform the probe-scsi command.


    Note -

    Be sure to turn on all SCSI devices, such as disk and tape drives, before you attempt to use the probe-scsi or probe-scsi-all commands. The probe-scsi command can detect connected SCSI devices only if they are turned on.


  7. List the SCSI target IDs that are currently used on the SCSI bus by typing:


    ok probe-scsi 
    

    If you have more than one SCSI bus on your system, use the probe-scsi-all command. This command probes for all SCSI devices on every SCSI bus.

  8. Choose an unused SCSI target ID for your new device.

    Note the target IDs that are already assigned and choose an unused target ID for your new device. For more information on selecting a target ID see Appendix A, SCSI Addressing".

  9. After the ok prompt is displayed, turn off the power to the system and then to all external peripheral devices.

You are now ready to install the peripheral device. Refer to the documentation that accompanies your hardware and the appropriate section in this manual:

The shutdown Command

Use the /usr/sbin/shutdown command to shut down servers when users must be notified of the impending shutdown.

To Shut Down a Multiuser System Using shutdown

This section describes how to shut down a multiuser system, such as a server.

  1. Become superuser.

  2. To find out if users are logged into the system, type:


    # who 
    

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

  3. Stop all applications and close any open files on the system.

  4. Ensure that the operating system checks for newly installed peripheral devices when you power on or reboot your system, type:


    # touch /reconfigure 
    

    The touch /reconfigure command performs the same function as the boot -r command. It allows the operating system to recognize the presence of all newly installed peripheral devices.

  5. Shut down the system, by typing:


    # /usr/sbin/shutdown -y -ggrace_period -irun_level
    

    In this command:

     shutdown

    Brings a system to run level s (single-user mode) by default. A message is broadcast to all users. After a 60-second wait (default), you are asked to confirm that you want to shut down the system.

     -y

    Continues to shut down the system without intervention; otherwise, you are prompted to continue the shutdown process. 

    -ggrace_period

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

    -irun_level

    Allows you to bring the system to an run level that is different from the default. (Refer to Table 1-3 for run level information.) Specify a number for run_level.

    In the following example, the system will be brought to run level 0 in 3 minutes without requiring additional confirmation.


    # /usr/sbin/shutdown -y -g180 -i0
    Shutdown started.    Fri Nov 4 11:07:33 MST 1994
    Broadcast Message from root (console) on pluto Fri Nov 4 11:07:34
    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 

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


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

  7. If you are installing a new SCSI device continue with Step 8.

    If you are installing a new card continue with instructions in Chapter 5, Setting Up an Option Card."

  8. Reset the SCSI bus by typing:


    ok reset 
    Immediately press Stop-A once you see the banner on your
    screen.
    

    The reset command (reset-all on some systems) resets the SCSI bus and memory to ensure a effective probe-scsi search. The Stop-A key sequence interrupts the reboot process that normally results form the reset command. This way you remain at run level 0 to perform the probe-scsi command.


    Note -

    Be sure to turn on all SCSI devices, such as disk and tape drives, before you attempt to use the probe-scsi or probe-scsi-all commands. The probe-scsi command can detect connected SCSI devices only if they are turned on.


  9. List the SCSI target IDs that are currently used on the SCSI bus by typing:


    ok probe-scsi 
    

    If you have more than one SCSI bus on your system, use the probe-scsi-all command. This command probes for all SCSI devices on every SCSI bus.

  10. Choose an unused SCSI target ID for your device.

    Note the target IDs that are already assigned and choose an unused target for your new device. For more information on selecting a target ID see Appendix A, SCSI Addressing".

  11. After the ok prompt is displayed, turn off the power to the system and then to all external peripheral devices.

You are now ready to install the peripheral device. Refer to the documentation that accompanies your hardware, and the appropriate section in this manual: