Re: SSH login automation, get stuck at the last step.



Schubert wrote:

spawn ssh -p 10022 root@<Server IP address>


expect "root@<Server IP address>'s password: "
send "public\r"


expect {
"\[root@<Server Name>:<Server IP address>\] " {
send "run batch filename.txt\r"}
}

set output $expect_out(buffer)
puts "$output"
-------------------------------------------------
The $output will print out a warning like:
"Warning: Permanently added <Server IP Address> (RSA) to the list of
known hosts. root@<Server IP address>'s password: ".
I think it should print out the log on success message like: (please
refer to the manual step result on my first post)


<Server Name>
You're logged on from <Another Server IP address>


[root@<Server Name>:<Server IP address>]:"
But it does not. Anybody can figure out how this happens?
You still need to expect the output of your batchfile run!
otherwise no more input will be processed!
Have you tried to adapt the script I wrote in a previous post?

Btw, after the prompt "[root@<Server Name>:<Server IP address>]: "
appears on the screen for several minutes, it will exit to the unix
home directory (where I execute the Expect script) automatically.
autologout?



uwe
.



Relevant Pages