Created
September 2, 2015 16:41
-
-
Save jonespm/e5f176500eee7bf27b22 to your computer and use it in GitHub Desktop.
This file contains 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/zsh | |
# Run a script repeatedly until fail | |
# Idea from http://stackoverflow.com/questions/12967232/repeatedly-run-a-shell-command-until-it-fails | |
# If this is in your home dir you can just run it as | |
# ~/untilfail.sh "some command to run". Running maven tests are good ones | |
# ~/untilfail.sh "mvn test -Dtest=org.sakaiproject.sitestats.test.StatsUpdateManagerTest" | |
#shopt -s expand_aliases | |
#I have important functions and aliases in here | |
source ${HOME}/.zshrc | |
COUNT=1 | |
START=`date +%s` | |
echo "This is run number $COUNT" | |
$@ | |
while [ $? -eq 0 ]; do | |
((COUNT++)) | |
echo "This is run number $COUNT" | |
$@ | |
done | |
END=`date +%s` | |
RUNTIME=$((END-START)) | |
echo "Build failed at run number number $COUNT and took $RUNTIME seconds to fail." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment