Cette section décrit les opérations suivantes :
Utilisez la commande start avec le mot-clé server ou group et la sous-commande command pour lancer une commande à distance sur un serveur ou un groupe de serveurs. Tapez help start server or help start group à l'invite N1–ok de la ligne de commande pour connaître la syntaxe et les paramètres de la commande.
Cette procédure décrit comment envoyer une commande à distance. Une commande à distance est une commande UNIX envoyée à un serveur déployé pour son exécution sur ce serveur.
Vous devez installer les agents de gestion du SE avant de lancer la commande à distance sur des serveurs ou des groupes de serveurs. Reportez-vous à Installation des agents de gestion de SE .
Connectez-vous à N1 System Manager.
Pour plus de détails, reportez-vous au point Accès à la ligne de commande de N1 System Manager .
Tapez l'une des commandes suivantes :
N1-ok> start server serveur command "commande" |
La commande à distance est envoyée au serveur. Pour plus de détails, reportez-vous à start server.
N1-ok> start group groupe command "commande" |
La commande à distance est envoyée au groupe de serveurs. Pour plus de détails, reportez-vous à start group.
Arrêtez la tâche commandée à distance.
N1-ok> show job tâche |
La sortie de la commande à distance s'affiche dans la partie Résultat.
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 |
Les délais d'exécution sont mesurés en secondes. Le délai d'exécution par défaut est de deux heures. Si vous voulez désactiver le délai d'exécution, tapez la valeur zéro (0) dans la commande. L'exemple ci-après illustre une commande à distance avec un délai d'exécution de 20 secondes.
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 |