telnet and ssh login simaltaniously in expect
Posted by pgpatel (pgpatel), 16 August 2005hi .....
i have one question.....
i want to remote login using telnet ans ssh in two different server....and want to do some things....
first i want to do tenet with one server.....then after i want to login with ssh to another server.....again i want to see some result in first server....again in second server...so how can i maintain two login simaltaneously.....
i can spawn two different processes and and using spawn_id i can do this...but i donot have much idea....can u suggest me please.....? please give me some example code....
Posted by admin (Graham Ellis), 16 August 2005There are examples under our "Expect Processes" resource at http://www.wellho.net/resources/T212.html
Posted by pgpatel (pgpatel), 19 August 2005Thanks for reply....
I saw the example...i didnot get what exactly i want(may be i didnot understand)
I want to do first telnet login then ssh login...i want to continue some execution on ssh login in background and at the same time i again want to send some command to first telnet login....how can i do this ?
Posted by admin (Graham Ellis), 20 August 2005The thing about teaching examples is that they never do exactly what you want - you need to learn from them and adapt them.
You want to:
a) spawn a process and save its spawn_id
b) spawn the second process and save its spawn_id
Then when you want to send or expect from the first process, you can restore its spawn_id, and when you want to send or expect from the second process you can restore its spawn_id.
as an ALTERNATIVE to this last step, you can use the -i option on expect to tell in which processes (in a list if you wish) to expect from.
Hope that clarifies it ... the examples show some of these things, and your course notes (if you or a colleague have been on one of our courses) will give you a lot better / fuller description.
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: email@example.com • WEB: http://www.wellho.net • SKYPE: wellho