oracle禁用系统用户登录,关闭系统 - 在 x86 平台上引导和关闭 Oracle Solaris

关闭系统

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

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

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

holly console May 7 07:30

kryten pts/0 May 7 07:35 (starlite)

lister pts/1 May 7 07:40 (bluemidget)

第一列中的数据标识登录用户的用户名。

第二列中的数据标识登录用户的终端线。

第三列中的数据标识用户登录的日期和时间。

第四列中的数据(如果存在)标识用户从远程系统登录时的主机名。

如何使用 shutdown 命令关闭系统成为 root 角色。

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

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

关闭系统。# 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) 手册页。

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

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

如果出现提示,请键入 root 口令。Type Ctrl-d to proceed with normal startup,

(or give root password for system maintenance): xxxxxx

执行完任何系统管理任务后,请按 Ctrl-D 组合键,以返回到缺省的系统运行级别。

使用下表确认系统是否处于您在 shutdown 命令中指定的运行级别。

指定的运行级别

基于 x86 的系统提示符

S(单用户状态)

#

0(电源关闭状态)

#

运行级别 3(共享远程资源的多用户状态)

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.us.oracle.com

.

.

.

venus console login:

另请参见

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

如何使用 init 命令关闭系统

需要关闭独立系统时,请使用以下过程。成为 root 角色。

关闭系统。# 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)。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值