Expect script terminating too early
Posted by mnmitch (mnmitch), 23 August 2006Hi, I'm relatively new to Expect (but not to shell programming) and would appreciate any help in debugging a problem I'm having. The problem is intermittent; it seems to work about 60% of the time, so I'm having a tough time tracking root cause down.
At the heart of it, it seems the expect script is terminating prior to receiving all of the output from a command. Here is the expect script redacted (the expect script is being called from a shell script and its output being redirected to a single file):
Each of the commands (1, 2, and 3) results in nearly 20,000 lines of output.
Here's what's occuring when the script isn't working:
1. Command 3's output is truncated
2. Commands 2 and 3 look like they're being sent before the expected ">"; in the output file they appear in the midst of the command output
I've tried issuing "sleep" commands in place of the "expect eof" to no avail. I appreciate any help; if there's another thread I've missed that's addressed this, please let me know.
Thanks in advance.
Posted by admin (Graham Ellis), 23 August 2006As a first step, can I ask how long each of the intermeiate commands takes to run? It sounds as if they're quite big / long - in which case they may be timing out (the default is 10 seconds).
set timeout 60
before the first long command that you run to extend the time it waits (if it fails to detect the sequence you're expecting) to a minute .... of course, use any other figure if that would be more appropriate.
Posted by mnmitch (mnmitch), 23 August 2006I'll give it a shot. Thanks.
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: firstname.lastname@example.org • WEB: http://www.wellho.net • SKYPE: wellho