From: hadi motamedi on 5 May 2010 01:10 >>telnet, as in the original responses. Google gives several example scripts With many thanks for your reply, I found very simple expect telnet examples (like the case that I am dealing with) so I wrote for the same but it doesn't work my case. Do you think it may come from the fact that the remote node is VxWorks or maybe some mistake in my code?
From: Kevin Ross on 5 May 2010 03:40 On 5/4/2010 10:01 PM, hadi motamedi wrote: > >>telnet, as in the original responses. Google gives several example > scripts > With many thanks for your reply, I found very simple expect telnet > examples (like the case that I am dealing with) so I wrote for the > same but it doesn't work my case. Do you think it may come from the > fact that the remote node is VxWorks or maybe some mistake in my code? > It doesn't matter what the remote system is, as long as it has telnet, which I'm assuming it does, since that's what you originally asked about. To be able to help, we would need to know the output you are getting when you run it, and probably the contents of the expect script that you are using (edit out any passwords). -- To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org Archive: http://lists.debian.org/4BE11EBC.6050206(a)familyross.net
From: hadi motamedi on 5 May 2010 04:10 > It doesn't matter what the remote system is, as long as it has telnet, > which I'm assuming it does, since that's what you originally asked about. > To be able to help, we would need to know the output you are getting when > you run it, and probably the contents of the expect script that you are > using (edit out any passwords). > > > > > Please find below my simple expect telnet script : /usr/bin/expect >set name 172.16.17.160 >spawn telnet $name >set cmd1 command1 >set cmd2 logout >send "$cmd1" >send "$cmd2" >exit When I try for this procedure , I just see loging in and loging out from the telnet session . Actually , I need to have the output result of issuing 'command1' on the remote node to be captured on my local host . But when I try manually , say telnet to it and issue the command , I see the output on my screen . Please help me how to modify my simple code to have the desired result? Thank you
From: d.sastre.medina on 5 May 2010 13:40 Hello, If issuing the commands manually produces the desired output, you could try autoexpect¹ and edit the output of running an autoexpect session to your liking. There is a manual page too². Hope it helps. Regards. ¹http://expect.nist.gov/example/autoexpect ²http://expect.nist.gov/example/autoexpect.man.html -- Huella de clave primaria: 0FDA C36F F110 54F4 D42B D0EB 617D 396C 448B 31EB
From: Kevin Ross on 5 May 2010 14:40 Please find below my simple expect telnet script : /usr/bin/expect >set name 172.16.17.160 >spawn telnet $name >set cmd1 command1 >set cmd2 logout >send "$cmd1" >send "$cmd2" >exit When I try for this procedure , I just see loging in and loging out from the telnet session . Actually , I need to have the output result of issuing 'command1' on the remote node to be captured on my local host . But when I try manually , say telnet to it and issue the command , I see the output on my screen . Please help me how to modify my simple code to have the desired result? Thank you __________________________________________ It doesn't require a username or password? I'm guessing it's sending the first command "command1" too soon, before the command prompt appears, so the other end doesn't see it. It only sees the logout command. Try adding: expect "% " or whatever the command prompt is, such as "$ " or "# " before sending the commands. -- To UNSUBSCRIBE, email to debian-user-REQUEST(a)lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster(a)lists.debian.org Archive: http://lists.debian.org/023d01caec81$1393a560$3abaf020$@net
|
Next
|
Last
Pages: 1 2 Prev: Memory footprint of a mail server Next: curious gnome desktop behaviour after upgrade |