Sun N1 System Manager 1.1 管理ガイド

サーバーおよびサーバーグループへのリモートコマンドの発行

ここでは、サーバーまたはサーバーグループにリモートコマンドを発行する手順を説明します。

サーバーまたはサーバグループにリモートコマンドを発行するには、start コマンドを、server または group キーワードと command サブコマンドを使用します。構文とパラメータの詳細については、N1–ok コマンド行で help start server または help start groupと入力してください。

Procedureサーバーまたはサーバーグループにリモートコマンドを発行する。

ここでは、「リモートコマンド」を発行する手順を説明します。「リモート」コマンドは、 UNIX® コマンドで、プロビジョニング対象のサーバー上で実行するために、そのプロビジョニング対象サーバーに送信されます。

始める前に

サーバーまたはサーバーグループにリモートコマンドを発行するためには、その前に、OS 監視機能を追加する必要があります。「OS 監視機能を追加する」を参照してください。

手順
  1. N1 System Manager にログインします。

    詳細は、「N1 System Manager のコマンド行にアクセスする」を参照してください。

  2. 次のいずれかのコマンドを入力します。


    N1-ok> start server server command "command"
    

    サーバーにリモートコマンドが発行されます。詳細は、『Sun N1 System Manager 1.1 コマンド行レファレンスマニュアル』「start server」を参照してください。


    N1-ok> start group group command "command"
    

    サーバーグループにリモートコマンドが発行されます。詳細は、『Sun N1 System Manager 1.1 コマンド行レファレンスマニュアル』「start group」を参照してください。

  3. リモートコマンドジョブを表示します。


    N1-ok> show job job
    

    「結果」セクションにリモートコマンドの出力が表示されます。


例 4–17 サーバーへのリモートコマンドの発行

次のコマンド行の例は、start コマンドを使用し、サーバーにリモートコマンドを発行する方法を示しています。


N1-ok> start server hdco25 command "/bin/ls -l /"

Job "23" started.

次のコマンド行の例は、show コマンドを使用し、リモートコマンドの結果を表示する方法を示しています。


N1-ok> show job 23

Job ID:   23
Date:     2005-02-15T08:31:20-0700
Type:     Remote Command
Status:   Completed
Owner:    root
Errors:   0
Warnings: 0

Step 1:     
Type:        103
Description: native procedure /bin/sh /opt/sun/n1gc/bin/remotecmd.sh
:[RCMD_KEY]
Start:       2005-02-15T08:31:22-0700
Completion:  2005-02-15T08:31:26-0700
Result:      Complete
Exception:   No Data Available

.
.
.

Result :        
Server:          hdco25
Status:          0
Message:         Command executed successfully. Command: /bin/ls -l /
Standard Output: total 321
lrwxrwxrwx   1 root     root           9 Feb 11 13:21 bin -> ./usr/bin
drwxr-xr-x   4 root     sys          512 Feb 11 13:25 boot
drwxr-xr-x   3 root     sys          512 Feb 11 14:27 cr
drwxr-xr-x  15 root     sys         4096 Feb 11 14:09 dev
drwxr-xr-x   5 root     sys          512 Feb 11 14:06 devices
drwxr-xr-x  58 root     root        4096 Feb 14 12:36 etc
drwxr-xr-x   2 root     sys          512 Feb 11 13:46 export
dr-xr-xr-x   1 root     root           1 Feb 11 14:11 home
drwxr-xr-x  12 root     sys          512 Feb 11 13:25 kernel
lrwxrwxrwx   1 root     root           9 Feb 11 13:21 lib -> ./usr/lib


例 4–18 タイムアウト付きのリモートコマンドの発行

タイムアウト時間は秒単位で、デフォルトのタイムアウトは 2 時間です。タイムアウトを無効にする場合は、コマンドに値ゼロを入力します。次の例は、リモートコマンドのタイムアウトを 20 秒に設定する方法を示しています。


N1-ok> start server hdco25 command "/root/sleep.sh 60" timeout 20

Job "10" started.

次のコマンド行の例は、show コマンドを使用し、リモートコマンドの結果を表示する方法を示しています。


N1-ok> show job 10

Job ID:   10
Date:     2005-02-15T16:46:45-0700
Type:     Remote Command
Status:   Completed
Owner:    root
Errors:   0
Warnings: 0

Step 1:     
Type:        103
Description: native procedure /bin/sh /opt/sun/n1gc/bin/remotecmd.sh
:[RCMD_KEY]
Start:       2005-02-15T16:46:48-0700
Completion:  2005-02-15T16:47:10-0700
Result:      Complete
Exception:   No Data Available

.
.
.

Result :        
Server:          hdco25
Status:          -2
Message:         Command running on hdco25 did not finish within the
specified time limit of 20 seconds. Command: /root/sleep.sh 60
Standard Output: Sleeping for 60 seconds...


例 4–19 サーバーグループへのリモートコマンドの発行

次のコマンド行の例は、start コマンドを使用し、サーバーグループにリモートコマンドを発行する方法を示しています。


N1-ok> start group g1 command "/bin/ls -l /"

Job "24" started.

次のコマンド行の例は、show コマンドを使用し、リモートコマンドの結果を表示する方法を示しています。


N1-ok> show job 24

Job ID:   24
Date:     2005-02-15T08:31:20-0700
Type:     Remote Command
Status:   Completed
Owner:    root
Errors:   0
Warnings: 0

Step 1:     
Type:        103
Description: native procedure /bin/sh /opt/sun/n1gc/bin/remotecmd.sh
:[RCMD_KEY]
Start:       2005-02-15T08:31:22-0700
Completion:  2005-02-15T08:31:26-0700
Result:      Complete
Exception:   No Data Available

.
.
.

Result :        
Server:          server1
Status:          0
Message:         Command executed successfully. Command: /bin/ls -l /
Standard Output: total 321
lrwxrwxrwx   1 root     root           9 Feb 11 13:21 bin -> ./usr/bin
drwxr-xr-x   4 root     sys          512 Feb 11 13:25 boot
drwxr-xr-x   3 root     sys          512 Feb 11 14:27 cr
drwxr-xr-x  15 root     sys         4096 Feb 11 14:09 dev
drwxr-xr-x   5 root     sys          512 Feb 11 14:06 devices
drwxr-xr-x  58 root     root        4096 Feb 14 12:36 etc
drwxr-xr-x   2 root     sys          512 Feb 11 13:46 export
dr-xr-xr-x   1 root     root           1 Feb 11 14:11 home
drwxr-xr-x  12 root     sys          512 Feb 11 13:25 kernel
lrwxrwxrwx   1 root     root           9 Feb 11 13:21 lib -> ./usr/lib
Server:          server2
Status:          0
Message:         Command executed successfully. Command: /bin/ls -l /
Standard Output: total 321
lrwxrwxrwx   1 root     root           9 Feb 11 13:21 bin -> ./usr/bin
drwxr-xr-x   4 root     sys          512 Feb 11 13:25 boot
drwxr-xr-x   3 root     sys          512 Feb 11 14:27 cr
drwxr-xr-x  15 root     sys         4096 Feb 11 14:09 dev
drwxr-xr-x   5 root     sys          512 Feb 11 14:06 devices
drwxr-xr-x  58 root     root        4096 Feb 14 12:36 etc
drwxr-xr-x   2 root     sys          512 Feb 11 13:46 export
dr-xr-xr-x   1 root     root           1 Feb 11 14:11 home
drwxr-xr-x  12 root     sys          512 Feb 11 13:25 kernel
lrwxrwxrwx   1 root     root           9 Feb 11 13:21 lib -> ./usr/lib

参照

例 5–12