View previous topic :: View next topic |
Author |
Message |
Bapt Veteran
Joined: 14 Apr 2003 Posts: 1152 Location: Paris
|
Posted: Mon Oct 30, 2006 10:05 am Post subject: [SCRIPT]rebond telnet (résolu) |
|
|
Bonjour,
je suis en train de faire un script qui va faire un telnet sur un switch (monswitch2 en rebondissant sur un autre switch (monswitch). mon script fonctionne et ressemble à ça
Code: |
#!/bin/sh
(while read line;do
echo $line
sleep 1
done <<EOF
login
mdp
telnet monswitch2
login
mdp
EOF
) | telnet monswitch
|
Tout fonctionne bien, j'arrive à me connecter au second switch, mais une fois le while terminé, le telnet est coupé, or je voudrai que mon terminal reste ouvert sur le telnet monswitch2. Est ce que quelqu'un à une idée ?
Last edited by Bapt on Tue Oct 31, 2006 5:28 pm; edited 1 time in total |
|
Back to top |
|
|
avendesora Veteran
Joined: 16 Aug 2002 Posts: 1739 Location: Betelgeuse vicinity
|
Posted: Tue Oct 31, 2006 4:42 pm Post subject: |
|
|
Est-ce que tu as essayé en mettant tes cmds de login/rebond dans un petit fichier (connect_switch2.txt) et en faisant qqch comme ceci:
Code: | #!/bin/sh
cat connnect_switch2.txt - | (while read line ; do echo $line ; sleep 1 ; done ) | telnet monswitch
|
(Pas testé du tout...) |
|
Back to top |
|
|
Bapt Veteran
Joined: 14 Apr 2003 Posts: 1152 Location: Paris
|
Posted: Tue Oct 31, 2006 4:59 pm Post subject: |
|
|
Non je vais essayé, mais je n'y crois pas trop |
|
Back to top |
|
|
Bapt Veteran
Joined: 14 Apr 2003 Posts: 1152 Location: Paris
|
Posted: Tue Oct 31, 2006 5:03 pm Post subject: |
|
|
Ca marche Merci beaucoup |
|
Back to top |
|
|
|