1 | #! /bin/sh |
---|
2 | # This script repeats its arguments until failure. stderr/out of the failed/terminating run is stored in ${OUTNAME}.log which can be set as an argument to -o. `time` for each run is logged in ${OUTNAME}_times.log. For convenient testing uncomment THRESH and associated test. |
---|
3 | OUTNAME=$1"_repeater" |
---|
4 | if getopts "o:" OUTPUT; then |
---|
5 | OUTNAME=${OPTARG}; |
---|
6 | fi |
---|
7 | let OPTIND=${OPTIND}-1 |
---|
8 | shift ${OPTIND} |
---|
9 | touch INDICATOR; |
---|
10 | while [ -f INDICATOR ]; |
---|
11 | do |
---|
12 | (time if !($* > ${OUTNAME}.log 2>&1 );then mv INDICATOR INDICATOR_NEG;fi) 2>> ${OUTNAME}_times.log; |
---|
13 | #THRESH=1000; |
---|
14 | #if [[ ${RANDOM} -lt ${THRESH} ]];then mv INDICATOR INDICATOR_NEG;fi |
---|
15 | done |
---|