成为超级用户或同等角色。
角色包含授权和具有一定权限的命令。有关角色的更多信息,请参见 《系统管理指南:安全性服务》中的“配置 RBAC(任务列表)”。
了解用户是否已登录到系统。
# who |
屏幕上会显示所有登录用户的列表。您可能需要发送邮件或广播消息,以使用户知道系统即将关闭。
# shutdown -iinit-level -ggrace-period -y |
使系统进入到与缺省级别 S 不同的 init 级别。选项包括 0、1、2、5 和 6。
运行级别 0 和 5 是为关闭系统而保留的状态。运行级别 6 用于重新引导系统。运行级别 2 可用作多用户操作状态。
指示系统关闭前的时间(以秒为单位)。缺省值为 60 秒。
继续关闭系统,无需任何介入。否则,系统会提示您在 60 秒后继续执行关闭过程。
有关更多信息,请参见 shutdown(1M) 手册页。
如果系统要求您确认,请键入 y。
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 |
完成系统管理任务后,请按 Control-D 组合键,以返回到缺省的系统运行级别。
使用下表确认系统是否处于您在 shutdown 命令中指定的运行级别。
指定的运行级别 |
基于 SPARC 的系统提示符 |
基于 x86 的系统提示符 |
---|---|---|
S(单用户级别) |
# |
# |
0(电源关闭级别) |
ok 或 > |
Press any key to reboot |
运行级别 3(共享远程资源的多用户级别) |
hostname console login: |
hostname console login: |
在以下示例中,使用 shutdown 命令可使基于 SPARC 的系统在三分钟内进入运行级别 S(单用户级别)。
# 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 # |
在以下示例中,使用 shutdown 命令可使基于 SPARC 的系统在 5 分钟内进入运行级别 0,而无需进行其他确认。
# 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 |
如果要使系统进入运行级别 0 以关闭所有设备的电源,请参见如何关闭所有设备的电源。
在以下示例中,使用 shutdown 命令可将基于 SPARC 的系统在两分钟内重新引导至运行级别 3。不需要进行其他确认。
# 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: |
无论您为何关闭系统,您都可能希望返回运行级 3,在该级别下所有的文件资源都可用且用户可以登录。有关使系统返回多用户级别的说明,请参见第 12 章。