Last active
August 29, 2015 14:02
-
-
Save wting/132d78f95019a5d22ab5 to your computer and use it in GitHub Desktop.
Runs a command continuously (e.g. rsync) until it succeeds (0 exit code).
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
#!/usr/bin/bash | |
nevergonnagiveyouup() { | |
false | |
while [ $? -ne 0 ]; do | |
${@} | |
if [ $? -ne 0 ]; then | |
echo "[$(\date +%Y.%m.%d_%H%M)] FAIL: trying again in 60 seconds..." | |
sleep 60 | |
false | |
fi | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment