Hello,
First of all I want to say I'm starting to write these kind of script, so really newbie level.
I'm trying to create a script which will telnet into many different boxes (linux & Unix based)and from these device telnet into a sub-component, then run a simple command capturing partially the output and collect it into a text file.
But I've just tried the simple telnet without files which will provide the IP and it stopped at the password:
Here is the script:
WMSCANLAB:/usr/local/bin <114> (root) % vi login.expect
"login.expect" 8 lines, 174 characters
#!/usr/local/bin/expect ^M
spawn telnet 125.121.239.90 ^M
expect "BUSY BOX login:"
send "nodea\n"
expect "Password: "
send "nodeblny\n"
send "cd /pltf\n" ^M
send "cd /cpri\n" ^M
Here is the results:
WMSCANLAB:/usr/local/bin <113> (root) % expect -f login.expect
spawn telnet 125.121.239.90
Trying 125.121.239.90...
Connected to 125.121.239.90.
Escape character is '^]'.
BUSY BOX login: nodea
Password: WMSCANLAB:/usr/local/bin <114> (root) %
It doesn't go further, what is wrong?
Do i have to have Expect in each single box or just whereI initiate the script?
Once I fix this, how can I make the IP as a variable which it will take the info from a text file?
Thanks,
Sylvain
First of all I want to say I'm starting to write these kind of script, so really newbie level.
I'm trying to create a script which will telnet into many different boxes (linux & Unix based)and from these device telnet into a sub-component, then run a simple command capturing partially the output and collect it into a text file.
But I've just tried the simple telnet without files which will provide the IP and it stopped at the password:
Here is the script:
WMSCANLAB:/usr/local/bin <114> (root) % vi login.expect
"login.expect" 8 lines, 174 characters
#!/usr/local/bin/expect ^M
spawn telnet 125.121.239.90 ^M
expect "BUSY BOX login:"
send "nodea\n"
expect "Password: "
send "nodeblny\n"
send "cd /pltf\n" ^M
send "cd /cpri\n" ^M
Here is the results:
WMSCANLAB:/usr/local/bin <113> (root) % expect -f login.expect
spawn telnet 125.121.239.90
Trying 125.121.239.90...
Connected to 125.121.239.90.
Escape character is '^]'.
BUSY BOX login: nodea
Password: WMSCANLAB:/usr/local/bin <114> (root) %
It doesn't go further, what is wrong?
Do i have to have Expect in each single box or just whereI initiate the script?
Once I fix this, how can I make the IP as a variable which it will take the info from a text file?
Thanks,
Sylvain