Make retry tool generic

This commit is contained in:
BtbN 2022-07-13 01:46:13 +02:00
parent b7ca4432e1
commit d1dd644b80
6 changed files with 19 additions and 15 deletions

14
images/base/retry-tool.sh Executable file
View file

@ -0,0 +1,14 @@
#!/bin/bash
set -xe
RETRY_COUNTER=0
MAX_RETRY=15
while [[ $RETRY_COUNTER -lt $MAX_RETRY ]]; do
timeout 120 "$@" && break || sleep 10
RETRY_COUNTER=$(( $RETRY_COUNTER + 1 ))
echo "Retry $RETRY_COUNTER..."
done
if [[ $RETRY_COUNTER -ge $MAX_RETRY ]]; then
echo "Max retry count exceeded."
exit 1
fi