Ticket #659: command_repeater.sh

File command_repeater.sh, 651 bytes (added by arch_o_median, at 2009-03-14T03:05:24Z)

Script used to run test on a loop.

Line 
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. 
3OUTNAME=$1"_repeater"
4if getopts "o:" OUTPUT; then
5    OUTNAME=${OPTARG};
6fi
7let OPTIND=${OPTIND}-1
8shift ${OPTIND}
9touch INDICATOR;
10while [ -f INDICATOR ];
11do
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
15done