Skip to content

Instantly share code, notes, and snippets.

Avatar

Hunter Richardson hunter-richardson

View GitHub Profile
@sj26
sj26 / retry.sh
Created Dec 8, 2016
Bash retry function
View retry.sh
# Retry a command up to a specific numer of times until it exits successfully,
# with exponential back off.
#
# $ retry 5 echo Hello
# Hello
#
# $ retry 5 false
# Retry 1/5 exited 1, retrying in 1 seconds...
# Retry 2/5 exited 1, retrying in 2 seconds...
# Retry 3/5 exited 1, retrying in 4 seconds...