sur linux redhat je voudrai lancer un script sur deux machines distantes (redhat aussi) avec ssh comme suit :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
host=( inj7 inj8 )
for h in `echo ${host[*]}`
do
      cmd="load.sh; exit"
      ssh root@$h $cmd
done
le problème c'est que lorsque la commande ssh est lancée, et aprés l'exécussion du script sur la première machine, il ne donne pas la main est il reste bloquer à la fin du script load.sh sans passé à la deusième itération.

j'ai lancé aussi ce bout de code avec activation du mode debug de la commande ssh le résultat est :

[root@inj9 test-004]# ./run.sh


launching laod testing ....


command to launch in inj7 is : load.sh -e -p atlas

OpenSSH_3.9p1, OpenSSL 0.9.7a Feb 19 2003
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to inj7 [139.54.159.179] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: identity file /root/.ssh/identity type -1
debug1: identity file /root/.ssh/id_rsa type -1
debug1: identity file /root/.ssh/id_dsa type 2
debug1: Remote protocol version 2.0, remote software version OpenSSH_3.9p1
debug1: match: OpenSSH_3.9p1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_3.9p1
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'inj7' is known and matches the RSA host key.
debug1: Found key in /root/.ssh/known_hosts:25
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: /root/.ssh/identity
debug1: Trying private key: /root/.ssh/id_rsa
debug1: Offering public key: /root/.ssh/id_dsa
debug1: Server accepts key: pkalg ssh-dss blen 435
debug1: read PEM private key done: type DSA
debug1: Authentication succeeded (publickey).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: Sending command: export LOAD_TESTING_DIR=/opt/loadTesting;/opt/loadTesting/load.sh -e -p atlas; exit
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
--------------------------------------------------------------------------------------------------------

l'exécussion reste bloquer à ce niveau sans passer à l'itéraion 2 pour exécuter le script load.sh sur inj8

la dérnière ligne du script load.sh est exit 0

quelqu'u pourra m'expliquer ce qu'il passe ?? et comment puis je résoudre ce problème ??

merci