I have a simple Expect script to power a system on and off in an endless loop looking for an ERROR message at which point the script should exit. But I need to skip the first 60 seconds after each power on or off and not exit if there are ERROR messages during that time. I thought I could use "sleep 60" to wait then clear the expect buffer with "expect *" but the script is exiting when there's an ERROR within that first 60 seconds.
while {1} {
send "\r"
expect ">"
send "pwron\r"
sleep 60
expect *
set timeout 300
expect "ERROR" {break}
send "\r"
expect ">"
send "pwroff\r"
sleep 60
expect *
set timeout 300
expect "ERROR" {break}
}
Seems simple, but I clearly haven't developed the knowledge to do this correctly yet. Can anyone see what I'm doing wrong? Any help would be appreciated.