JavaScript is required to for searching.
跳过导航链接
退出打印视图
引导和关闭 Oracle Solaris 11.1 系统     Oracle Solaris 11.1 Information Library (简体中文)
search filter icon
search icon

文档信息

前言

1.  引导和关闭系统(概述)

2.  x86: 管理 GRand Unified Bootloader(任务)

3.  关闭系统(任务)

关闭系统

系统关闭指南

系统关闭命令

关闭系统

如何确定登录到系统的用户

如何使用 shutdown 命令关闭系统

如何使用 init 命令关闭独立系统

关闭系统设备电源

4.  引导系统(任务)

5.  从网络引导系统(任务)

6.  对引导系统进行故障排除(任务)

索引

关闭系统

以下过程和示例说明如何使用 shutdowninit 命令关闭系统。

有关关闭系统以进行恢复(包括使用 halt 命令)的信息,请参见SPARC: 如何为进行恢复而停止系统

如何确定登录到系统的用户

对于作为多用户分时系统的 Oracle Solaris 系统,关闭系统前可能需要确定是否有任何用户登录到系统。在这些实例中使用以下过程。

如何使用 shutdown 命令关闭系统

  1. 承担 root 角色。

    请参见《Oracle Solaris 11.1 管理:安全服务》中的"如何使用指定给您的管理权限"

  2. 对于服务器关闭,查明是否有任何用户登录到系统。
    # who

    屏幕上会显示所有登录用户的列表。

  3. 关闭系统。
    # shutdown -iinit-state -ggrace-period -y
    -iinit-state

    使系统进入到与缺省级别 S 不同的 init 状态。选项包括 0、1、2、5 和 6。

    运行级别 0 和 5 是为关闭系统而保留的状态。运行级别 6 用于重新引导系统。运行级别 2 可用作多用户操作状态。

    -ggrace-period

    指示系统关闭前的时间(以秒为单位)。缺省值为 60 秒。

    -y

    继续关闭系统,无需任何介入。否则,系统会提示您在 60 秒后继续执行关闭过程。

    有关更多信息,请参见 shutdown(1M) 手册页。

  4. 如果系统要求您确认,请键入 y
    Do you want to continue? (y or n): y

    如果使用了 shutdown -y 命令,系统将不提示您继续操作。

  5. 如果出现提示,请键入 root 口令。
    Type Ctrl-d to proceed with normal startup,
    (or give root password for system maintenance): xxxxxx
  6. 执行完任何系统管理任务后,请按 Ctrl-D 组合键,以返回到缺省的系统运行级别。
  7. 使用下表确认系统是否处于您在 shutdown 命令中指定的运行级别。
    指定的运行级别
    基于 x86 的系统提示符
    基于 SPARC 的系统提示符
    S(单用户状态)
    #
    #
    0(电源关闭状态)
    #
    ok>
    运行级别 3(共享远程资源的多用户状态)
    hostname console login:
    hostname console login:

示例 3-1 使用 shutdown 命令使系统进入单用户状态(运行级别 S)

在以下示例中,使用 shutdown 命令使系统在三分钟内进入运行级别 S(单用户状态)。

# who
root     console      Apr 15 06:20

# shutdown -g180 -y

Shutdown started.    Fri Apr 15 06:20:45 MDT 2011

Broadcast Message from root (console) on portia Fri Apr 15 06:20:46...
The system portia will be shut down in 3 minutes

showmount: portia: RPC: Program not registered
Broadcast Message from root (console) on portia Fri Apr 15 06:21:46...
The system portia will be shut down in 2 minutes

showmount: portia: RPC: Program not registered
Broadcast Message from root (console) on portia Fri Apr 15 06:22:46...
The system portia will be shut down in 1 minute

showmount: portia: RPC: Program not registered
Broadcast Message from root (console) on portia Fri Apr 15 06:23:16...
The system portia will be shut down in 30 seconds

showmount: portia: RPC: Program not registered
Changing to init state s - please wait
svc.startd: The system is coming down for administration.  Please wait.
root@portia:~# Apr 15 06:24:28 portia svc.startd[9]:

Apr 15 06:24:28 portia syslogd: going down on signal 15
svc.startd: Killing user processes.
Requesting System Maintenance Mode
(See /lib/svc/share/README for more information.)
SINGLE USER MODE

Enter user name for system maintenance (control-d to bypass):xxxxxx
#

示例 3-2 使用 shutdown 命令使系统进入关闭状态(运行级别 0)

在以下示例中,使用 shutdown 命令使系统在五分钟内进入运行级别 0,而无需进行其他确认操作。

# who
root       console       Jun 17 12:39...
userabc         pts/4        Jun 17 12:39   (:0.0)
# shutdown -i0 -g300 -y
Shutdown started.    Fri Apr 15 06:35:48 MDT 2011

Broadcast Message from root (console) on murky Fri Apr 15 06:35:48...
The system pinkytusk will be shut down in 5 minutes

showmount: murkey: RPC: Program not registered
showmount: murkey: RPC: Program not registered
Broadcast Message from root (console) on murkey Fri Apr 15 06:38:48...
The system murkey will be shut down in 2 minutes

showmount: murkey: RPC: Program not registered
Broadcast Message from root (console) on murkey Fri Apr 15 06:39:48...
The system murkey will be shut down in 1 minute

showmount: murkey: RPC: Program not registered
Broadcast Message from root (console) on murkey Fri Apr 15 06:40:18...
The system murkey  will be shut down in 30 seconds

showmount: murkey: RPC: Program not registered
Broadcast Message from root (console) on murkey Fri Apr 15 06:40:38...
THE SYSTEM murkey IS BEING SHUT DOWN NOW ! ! !
Log off now or risk your files being damaged

showmount: murkey: RPC: Program not registered
Changing to init state 0 - please wait
root@murkey:~# svc.startd: The system is coming down.  Please wait.
svc.startd: 122 system services are now being stopped.
Apr 15 06:41:49 murkey svc.startd[9]:
Apr 15 06:41:50 murkey syslogd: going down on signal 15
svc.startd: Killing user processes.
Apr 15 06:41:57 The system is down.  Shutdown took 69 seconds.
syncing file systems... done
Press any key to reboot.
Resetting...

如果要使系统进入运行级别 0 以关闭所有设备的电源,请参见关闭系统设备电源

示例 3-3 使用 shutdown 命令使系统进入多用户状态(运行级别 3)

在以下示例中,使用 shutdown 命令在两分钟内将系统重新引导至运行级别 3。不需要进行其他确认。

# who
root           console      Jun 14 15:49    (:0)
userabc    pts/4        Jun 14 15:46    (:0.0)
# shutdown -i6 -g120 -y
Shutdown started.    Fri Apr 15 06:46:50 MDT 2011

Broadcast Message from root (console) on venus Fri Apr 15 06:46:50...
The system venus will be shut down in 2 minutes

showmount: venus: RPC: Program not registered
showmount: venus: RPC: Program not registered
Broadcast Message from root (console) on venus Fri Apr 15 06:47:50...
The system venus will be shut down in 1 minute

showmount: venus: RPC: Program not registered
showmount: venus: RPC: Program not registered
Broadcast Message from root (console) on venus Fri Apr 15 06:48:20...
The system venus will be shut down in 30 seconds

showmount: venus: RPC: Program not registered
Broadcast Message from root (console) on venus Fri Apr 15 06:48:40...
THE SYSTEM venus IS BEING SHUT DOWN NOW ! ! !
Log off now or risk your files being damaged

showmount: venus: RPC: Program not registered
Changing to init state 6 - please wait
root@venus:~# svc.startd: The system is coming down.  Please wait.
svc.startd: 123 system services are now being stopped.
Apr 15 06:49:32 venus svc.startd[9]:
Apr 15 06:49:32 venus syslogd: going down on signal 15
svc.startd: Killing user processes.
Apr 15 06:49:40 The system is down.  Shutdown took 50 seconds.
syncing file systems... done
rebooting...
SunOS Release 5.11 Version 2010-12-10 64-bit
Copyright (c) 1983, 2010, Oracle and/or its affiliates. All rights reserved.
Booting to milestone "milestone/single-user:default".
Hostname: venus
NIS domain name is solaris.example.com
.
.
.
venus console login:

另请参见

无论您为何关闭系统,您都可能希望返回运行级 3,在该级别下所有的文件资源都可用且用户可以登录。有关将系统恢复到多用户状态的说明,请参见第 4 章

如何使用 init 命令关闭独立系统

需要关闭独立系统时,请使用以下过程。

  1. 承担 root 角色。

    请参见《Oracle Solaris 11.1 管理:安全服务》中的"如何使用指定给您的管理权限"

  2. 关闭系统。
    # init 5

    有关更多信息,请参见 init(1M) 手册页。

示例 3-4 使用 init 命令使系统进入关闭状态(运行级别 0)

在该示例中,init 命令用于使独立系统进入可以安全关闭电源的运行级别。

# 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

另请参见

无论您为何关闭系统,您都可能希望返回运行级 3,在该级别下所有的文件资源都可用且用户可以登录。