Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
 
This week, we're updating our course layouts and descriptions. Presentation and materials always gently change over time, but just occasionally there's a need to make a step change to clear out some of the old and roll in the new. That's now happening - but over a long and complex site it's not instant and you'll see sections of the site changing up to and including 19th September.

See also [here] for status update
 
general help with tcl/expect

Posted by katiep (katiep), 1 June 2006
I am trying to make a program that other people can run without installing much of anything that will attempt to log them onto a lot of different servers SSH and then have an output file or something that will list what servers they were not able to log on to.

The list of servers would be the same for each person who runs the program, but it would have to have input for their username and password (which would be the same for every server).

I don't have any experience with Tcl or Expect though my boss says that those are the languages to look into.

Where do I start?

Also, I'm starting to understand the basics of the language, but I don't understand how I'm supposed to get the commands to a program, etc. to run.

Thanks for your help.

Posted by admin (Graham Ellis), 2 June 2006
I could write a whole book to answer you!

In order to help me "tune" my answer more specifically towards you, can I ask some further questions:

a) You say you're new to Tcl.  Are you familiar with any other languages?  Some others might be less technically ideal for the job, but you may not need to learn a new language if something else you already know could be used

b) What platform are your users going to be running from?  Are they going o be running from a specific system, such as Ubuntu 5.10 Linux, will it be a bit more general (e.g. any Red Hat Linux), or could it be whatever operating system happens to be on their computer - sometimes Windows, other times OS X, and so on?

c) Will people want to contact a specific list (yes, I know "a lot") of servers, or will they need to be able to add and remove from the list?   WIll these servers always look / react in the same way, or will they be a real mixture?

If Tcl and Expect turn out to be the right solution for you (and I'll be able to comment furher on this when I know some more answers), you'll have a lot to learn.   To start you off, I can point you at directorys of examples where Exepct calls up remove servers, passes them commands and collects the results.  However, to teach you Tcl through a forum is an impractical use of the resource and I would point you towards a book or - much more effective because Expect is something you'll need practicl help with in the early days - a course.

I have one further thought for you.  You say you don't want to install much of anything on the individual's computer, but normally Expect and Tcl would run in exactly that way, and I'm sure the people who wrote them wouldn't like them to be described as "not much of anything".   But these days, everyone has a browser available, and you might well wish to consider offering a web interface.   That wy, your code could be in a single central location ... and you would save a lot of maintainaince / tuning hassle.

For example, I need to be able to test all my servers from a single central location and I do so through a web page.   There's a brief description on line here, and you can run it here. The source code is available for you to look at and adapt as you see fit here - please do read the restrictions / limitations described at the end of that page, though.

Hopefully, I've got you started.  I'm quite happy to respond further and tune my advise once I know a little more about what you're wishing to do.

Posted by katiep (katiep), 2 June 2006
I am familiar with C++. I've found that the test server we use has been used in the past to run an Expect/Tcl program to change passwords on all the servers for a user so I will most likely put it there for people to access. Looking at this program has helped me a ton.

If I put it on this test server, the people using the program would log onto it with Putty.

I am an intern, and this is one of my 'projects' to learn Tcl and Expect to get this to work  

The list of servers would probably be the same for all people who run it, a list of 300+ servers to try to log on to. The list would probably be inside the program, not passed as arguments to it.

I'm pretty sure all the servers act the same way when you log on. Some give a long warning between the username and password prompts, but not much else differs.

Thanks for the response.

Posted by admin (Graham Ellis), 4 June 2006
Yes, Tcl / Expect on a central server, contacted via putty, seems a reasonable approach. I would recommend that you do NOT hardwire the servers into the code, but rather maintain a separate datafile for them that you can change as necessary.

Let me alert you ahead of time. Expect (or any other system that automates the human interface) is extremely sensetive to slight differences and changes in server responses.  Something as simple as a server upgrade that adds an extra space into a prompt will go un-noticed by a human user, but may cause an expect process to fail completely.  With 300 servers, you can anticipate significant ongoing maintainance.

In order to help reduce maintainance, I suggest that you "classify" you hosts by their slightly different behaviours.  When hosts are upgraded and change their behaviour, all you would need to do would be to reclassify the host in question in your data file; only in the event of a new behaviour would you need to go back to the source and add in the new setup.   Yes, I understand that at the moment you're only seeing two behaviours ...



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.

You can Add a comment or ranking to this page

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