Solaris のシステム管理 (基本編)

サーバーをシャットダウンする方法

サーバーをシャットダウンする必要がある場合は、次の手順に従います。

  1. スーパーユーザーになります。

  2. システムにユーザーがログインしているか調べます。


    # who
    

    ログインしているすべてのユーザーがリスト表示されます。システムがシャットダウンされることを、メールかブロードキャストメッセージで知らせることをお勧めします。

  3. システムをシャットダウンします。


    # shutdown -iinit-level -ggrace-period -y
    

    -iinit-level

    システムをデフォルトの S 以外の init レベルにする。0、1、2、5、6 のいずれかを指定できる 

    -g grace-period

    システムがシャットダウンするまでの時間 (秒) を示す。デフォルト値は 60 秒 

    -y

    ユーザーの介入なしにシャットダウンを継続する。このオプションを指定しないと、シャットダウンを継続するかどうか 60 秒後にたずねられる 

    詳細については、shutdown(1M) のマニュアルページを参照してください。

  4. シャットダウンを継続するかどうかたずねられたら、y を入力します。


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

    -y オプションを指定した場合、このプロンプトは表示されません。

  5. プロンプトが表示されたら、スーパーユーザーのパスワードを入力します。


    Type Ctrl-d to proceed with normal startup,
    (or give root password for system maintenance): xxx
    
  6. システム管理作業を終了したら、Control + D を押してデフォルトの実行レベルに戻ります。

  7. 次の表を使用して、システムが shutdown コマンドで指定した実行レベルに移行したことを確認します。

    指定した実行レベル  

    SPARC システムのプロンプト  

    x86 システムのプロンプト 

    S (シングルユーザーレベル) 

    0 (電源切断レベル) 

    ok または >

    type any key to continue

    実行レベル 3 (リモートリソースを共有できるマルチユーザーレベル) 

    hostname console login:

    hostname console login:

SPARC: 例 — サーバーを実行レベル S にする

次の例では、shutdown コマンドを使用して、3 分後に、SPARC システムを実行レベル S (シングルユーザーレベル) にしています。


# who
root       console      Dec 13 14:30
# shutdown -g180 -y

Shutdown started.    Thu Dec 13 14:30:32 MST 2001

Broadcast Message from root (console) on earth Thu Dec 13 14:30:33...
The system earth will be shut down in 3 minutes 
.
.
.
Broadcast Message from root (console) on earth Thu Dec 13 14:30:33...
The system earth 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.
Dec 13 14:34:00 earth syslogd: going down on signal 15
Killing user processes: done.

INIT: SINGLE USER MODE

Type control-d to proceed with normal startup,
(or give root password for system maintenance): xxx
Entering System Maintenance Mode ...
# 

SPARC: 例 — サーバーを実行レベル 0 にする

次の例では、shutdown コマンドを使用して、SPARC システムを 5 分後に実行レベル 0 にしています。確認用プロンプトが表示されないように -y オプションを指定しています。


# who
root       console      Dec 12 08:08
rimmer     pts/0        Dec 11 14:48    (starbug)
pmorph     pts/1        Dec 13 12:31    (bluemidget)
# shutdown -i0 -g300 -y
Shutdown started.    Thu Dec 13 14:51:39 MST 2001

Broadcast Message from root (console) on earth Thu Dec 13 14:51:39...
The system earth 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 にしてすべてのデバイスの電源を落とす場合は、すべてのデバイスの電源を落とす方法を参照してください。

SPARC: 例 — サーバーをリブートして実行レベル 3 にする

次の例では、shutdown コマンドを使用して SPARC システムをリブートし、2 分後に実行レベル 3 にしています。確認用プロンプトが表示されないように -y オプションを指定しています。


# who
root       console      Dec 12 08:08
rimmer     pts/0        Dec 11 14:48    (starbug)
pmorph     pts/1        Dec 13 12:31    (bluemidget)
# shutdown -i6 -g120 -y
Shutdown started.    Thu Dec 13 15:56:30

Broadcast Message from root (console) on earth Thu Dec 13 15:56:30...
The system earth 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...
.
.
.
earth console login:

次に進む手順

システムをシャットダウンした理由が何であれ、最終的には、すべてのファイルリソースが使用でき、ユーザーがログインできる実行レベル 3 に戻すことになるでしょう。システムをマルチユーザーレベルに戻す手順については、第 13 章「SPARC: システムのブート (手順)」または第 14 章「x86: システムのブート (手順)」を参照してください。