Created
April 29, 2011 16:04
-
-
Save xlson/948532 to your computer and use it in GitHub Desktop.
Executes a command over and over until the command returns a non-zero exit code. Useful for running tests that should be, but aren't, deterministic.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
COMMAND=$1 | |
i=0 | |
echo "Executing: $COMMAND" | |
while true; do | |
i=$[$i+1] | |
echo "Run: $i ("`date`")" | |
$COMMAND 2>&1 1> run.log | |
if [ $? -ne 0 ]; then | |
echo "Command failed!" | |
break | |
fi | |
done | |
echo "Exiting." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment