Skip to content

Instantly share code, notes, and snippets.

@thealanberman
Created August 7, 2019 13:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thealanberman/73beb7c190031e462478d4199f407509 to your computer and use it in GitHub Desktop.
Save thealanberman/73beb7c190031e462478d4199f407509 to your computer and use it in GitHub Desktop.
Bash retry with timeout
# Lifted from https://stackoverflow.com/a/12321815
# Adjust command and retries as needed
NEXT_WAIT_TIME=0
RETRIES=5
until command || [[ "${NEXT_WAIT_TIME}" == "${RETRIES}" ]]; do
sleep $(( NEXT_WAIT_TIME++ ))
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment