Training, Open Source
computer languages


PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 

Search our site for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
telnet and ssh login simaltaniously in expect

Posted by pgpatel (pgpatel), 16 August 2005
hi .....
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....
thanks....


Posted by admin (Graham Ellis), 16 August 2005
There are examples under our "Expect Processes" resource at http://www.wellho.net/resources/T212.html

Posted by pgpatel (pgpatel), 19 August 2005
Thanks 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 ?
Thanking you

Posted by admin (Graham Ellis), 20 August 2005
The 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.





This page is a thread posted to the opentalk forum at www.opentalk.org.uk and archived here for reference. To jump to the archive index please follow this link.


WELL HOUSE CONSULTANTS LTD.: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 707126 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho