Skip to content

Instantly share code, notes, and snippets.

View simonkowallik's full-sized avatar
👂
to [ -~]+

Simon Kowallik simonkowallik

👂
to [ -~]+
View GitHub Profile
@simonkowallik
simonkowallik / retry.sh
Last active March 11, 2021 11:12 — forked from sj26/LICENSE.md
Bash retry function
# Retry a command with a fixed numer of times until it exits successfully,
# with exponential back off + 1.
# usage:
# $ source ./retry.sh
# $ retry echo "hello world"
# hello world
# $ retry false
# Retry 1/7: command exited with code 1, retrying in 2 seconds. Retrying...
# Retry 2/7: command exited with code 1, retrying in 3 seconds. Retrying...
# Retry 3/7: command exited with code 1, retrying in 5 seconds. Retrying...