跳过导航链接 | |
退出打印视图 | |
在 x86 平台上引导和关闭 Oracle Solaris Oracle Solaris 11 Information Library (简体中文) |
以下过程和示例说明如何使用 shutdown 和 init 命令关闭系统。
对于作为多用户分时系统的 Oracle Solaris 系统,关闭系统前可能需要确定是否有任何用户登录到系统。在这些实例中使用以下过程。
$ who holly console May 7 07:30 kryten pts/0 May 7 07:35 (starlite) lister pts/1 May 7 07:40 (bluemidget)
第一列中的数据标识登录用户的用户名。
第二列中的数据标识登录用户的终端线。
第三列中的数据标识用户登录的日期和时间。
第四列中的数据(如果存在)标识用户从远程系统登录时的主机名。
# who
屏幕上会显示所有登录用户的列表。
# shutdown -iinit-state -ggrace-period -y
使系统进入到与缺省级别 S 不同的 init 状态。选项包括 0、1、2、5 和 6。
运行级别 0 和 5 是为关闭系统而保留的状态。运行级别 6 用于重新引导系统。运行级别 2 可用作多用户操作状态。
指示系统关闭前的时间(以秒为单位)。缺省值为 60 秒。
继续关闭系统,无需任何介入。否则,系统会提示您在 60 秒后继续执行关闭过程。
有关更多信息,请参见 shutdown(1M) 手册页。
Do you want to continue? (y or n): y
如果使用了 shutdown -y 命令,系统将不提示您继续操作。
Type Ctrl-d to proceed with normal startup, (or give root password for system maintenance): xxxxxx
|
示例 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.us.oracle.com . . . venus console login:
另请参见
无论您为何关闭系统,您都可能希望返回运行级 3,在该级别下所有的文件资源都可用且用户可以登录。有关将系统恢复到多用户状态的说明,请参见将基于 x86 的系统引导至多用户状态(运行级别 3)。
需要关闭独立系统时,请使用以下过程。
# init 5
有关更多信息,请参见 init(1M) 手册页。
示例 3-4 使用 init 命令使系统进入关闭状态(运行级别 0)
在此示例中,使用 init 命令使基于 x86 的独立系统进入可安全关闭电源的运行级别。
# 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,在该级别下所有的文件资源都可用且用户可以登录。有关将系统恢复到多用户状态的说明,请参见将基于 x86 的系统引导至多用户状态(运行级别 3)。