Help with waiting for expression
Posted by newbie (newbie), 6 December 2005Hello 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.
Posted by admin (Graham Ellis), 7 December 2005The 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 2005Thanks 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!
Posted by admin (Graham Ellis), 8 December 2005If 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
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: firstname.lastname@example.org • WEB: http://www.wellho.net • SKYPE: wellho