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
 
For 2021 - online Python 3 training - see ((here)).

Our plans were to retire in summer 2020 and see the world, but Coronavirus has lead us into a lot of lockdown programming in Python 3 and PHP 7.
We can now offer tailored online training - small groups, real tutors - works really well for groups of 4 to 14 delegates. Anywhere in the world; course language English.

Please ask about private 'maintenance' training for Python 2, Tcl, Perl, PHP, Lua, etc.
Help with waiting for expression

Posted by newbie (newbie), 6 December 2005
Hello all.  I have a script that is run on one machine and then spawns a telnet to another machine where it sources another script.  This second script takes approximately 20 minutes to run and will either log a PASS or FAIL message when it is complete.

The problem I am experiencing is that when I start my script it telnets to the second machine and sources the second script fine.  However after about 5 minutes the script aborts without any indication why it aborts.  I have a large timeout value that is not reached.  If the timeout was reached I would see an error message reporting the timeout has exceeded. I do not see this message.

Also if I am on the second machine and manually source the second script it is able to run to completion. I only experience the problem when my first script runs and then telnets to the second machine and sources the second script.

Am I running out of some resources somewhere that I am not aware of?

Any help would be appreciated.  Thanks so much.

newbie

Posted by admin (Graham Ellis), 7 December 2005
The process runs correctly to completion when you log in directly on the box on which it runs, and it fails via telnet and expect from a remote box.

What happens when you run it with telnet but without expect fromthe remote box?   I suspect it will fail; I suspect that the telnet daemon on the server drops conenctions if there's been no activity for a certain period.

Posted by newbie (newbie), 8 December 2005
Thanks for the tip.  I do not expect that it is the telnet that is timing out.  I check and the tcp_keepalive_time is set to 7200 which is two hours on both systems.  

I do suspect that the expect buffer is filling up waiting to match the PASS or FAIL options.  The second script on the second machine generates alot of output.  I tried running the script without expecting the FAIL or PASS regexp.  I just sent the command to source the second script after telnetting to the second machine and then waited for 20 minutes.  This worked fine.

So now I am trying to figure out how to detect a full expect buffer and clear it while waiting for the PASS or FAIL keywords.  Any suggestions on achieving this would be appreciated.

Thanks again for your assistance!

newbie

Posted by admin (Graham Ellis), 8 December 2005
If the ouput is many, many lines long, why not write a loop which expects a \n OR the word PASS or FAIL ... and drop out of the loop only in the latter cases?    Even if that does not sort your problem out, it will let you understand where it's failing much better and help led you to a solution



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., 2021: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho