2022-07-12 23:46:13 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -xe
|
|
|
|
|
|
|
|
RETRY_COUNTER=0
|
2022-09-02 12:26:23 +00:00
|
|
|
MAX_RETRY=10
|
|
|
|
CUR_TIMEOUT=120
|
2022-07-12 23:46:13 +00:00
|
|
|
while [[ $RETRY_COUNTER -lt $MAX_RETRY ]]; do
|
2022-09-02 12:26:23 +00:00
|
|
|
timeout $CUR_TIMEOUT "$@" && break || sleep $(shuf -i 5-90 -n 1)
|
2022-07-12 23:46:13 +00:00
|
|
|
RETRY_COUNTER=$(( $RETRY_COUNTER + 1 ))
|
2022-09-02 12:26:23 +00:00
|
|
|
CUR_TIMEOUT=$(( $CUR_TIMEOUT + 60 ))
|
2022-07-12 23:46:13 +00:00
|
|
|
echo "Retry $RETRY_COUNTER..."
|
|
|
|
done
|
|
|
|
if [[ $RETRY_COUNTER -ge $MAX_RETRY ]]; then
|
|
|
|
echo "Max retry count exceeded."
|
|
|
|
exit 1
|
|
|
|
fi
|