ASIC/FPGA Design and Verification Out Source Services
Pipe your way with simple bash script to wait for process end and conditionally start a new one.
This script first waits for a given job to end. Upon job end detection, the script takes the following action:
- Measures the time it waited from script start to job end with a resolution of 5 seconds.
- Checks the assorted files, created by the job, for errors. If an error is found, the script exists with code 1, otherwise it returns 0 upon completion.
The returned error code value upon script end, makes it perfect for a conditional invocation:
~/bin/check_comp_results.unx 30300 && ~/bin/run_test.unx
Where 30300 is the job number, we want to wait for its finish.
Note that the script checks for file existence and if the file exists the script checks for errors:
Also note, that you can take full advantage of the grep command regular expression. In this case, I used regular expression to ignore the pattern Errors, shown in bold below.
...
if [ -e "specman.elog" ] ; then
cmd_1="grep \"Error[^s]\" specman.elog"
eval $cmd_1 >> /dev/null
if [ $? -eq 0 ] ; then
echo "specman.elog"
exit 1
fi
else
echo "no specman.elog"
exit 1
fi
...
The script is available at:
get bash script
|