Need to run a piece of code for certain duration when a master job is running. Basically some tool is writing a logFile, during logfile is written i used grep for Errors/Warnings from that logFile.
I use every loop which checks for the condition of job being running and then write a Error/Warning database, if job is not running it will print message. Problem: once it founds job is running, every loop is kicked on it never stops even the else condition is false.
I used break in if loop, but didn't work. How to stop every loop, please suggest.
proc every {ms body} {
eval $body
after $ms [info level 0]
}
proc run_this_loop {} {
catch {set job_name [exec qstat | awk {{print $3}} | grep liberate]} error
if {[string match *abnormally* $error]} {
puts "No background liberate job is found\n"
} else {
every 10000 {grepLoop}
}
}
every 1000 {run_this_loop}