ここでは、「リモートコマンド」を発行する手順を説明します。リモートコマンドは、プロビジョニング対象のサーバー上で実行するために、そのプロビジョニング対象のサーバーに送信される UNIX コマンドです。
サーバーまたはサーバーグループにリモートコマンドを発行するには、OS 管理エージェントをインストールしておく必要があります。「OS 管理エージェントをインストールする」を参照してください。
N1 System Manager にログインします。
詳細は、「N1 System Manager のコマンド行にアクセスする」を参照してください。
次のいずれかのコマンドを入力します。
N1-ok> start server server command "command" |
サーバーにリモートコマンドが発行されます。詳細は、「start server」を参照してください。
N1-ok> start group group command "command" |
サーバーグループにリモートコマンドが発行されます。詳細は、「start group」を参照してください。
リモートコマンドジョブを表示します。
N1-ok> show job job |
「結果」セクションにリモートコマンドの出力が表示されます。
N1-ok> start server hdco25 command "/bin/ls -l /" Job "23" started. 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 |
タイムアウト時間は秒単位で、デフォルトのタイムアウトは 2 時間です。タイムアウトを無効にする場合は、コマンドに値ゼロを入力します。次の例では、リモートコマンドのタイムアウトを 20 秒に設定しています。
N1-ok> start server hdco25 command "/root/sleep.sh 60" timeout 20 Job "10" started. 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... |
N1-ok> start group g1 command "/bin/ls -l /" Job "24" started. 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 |