[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

RE: How to schedule for a repeated task?



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.



Reply to: