Files
buryan-infra/ops/scripts/retry.sh
T
architect b8efe51b1b
lint / hygiene (push) Failing after 49s
standard / check (push) Successful in 13s
lint / hygiene (pull_request) Failing after 35s
standard / check (pull_request) Successful in 35s
[HYBRID-v3] architect handoff + retry policy 5x/120s
2026-12-04 00:08:29 +03:00

20 lines
402 B
Bash
Executable File

#!/bin/bash
# retry.sh — 5 attempts, 120s between, for transport failures only.
# usage: retry.sh <cmd> [args...]
set -u
n=0
max=5
while [ "$n" -lt "$max" ]; do
n=$((n+1))
echo "[retry] attempt $n/$max: $*" >&2
if "$@"; then
echo "[retry] success on attempt $n" >&2
exit 0
fi
if [ "$n" -lt "$max" ]; then
sleep 120
fi
done
echo "[retry] failed after $max attempts" >&2
exit 1