argus/src/web/build_tools/proxy/start-proxy-retry.sh

21 lines
490 B
Bash

#!/bin/sh
set -eu
MAX=${RETRY_MAX:-10}
DELAY=${RETRY_DELAY:-10}
ATTEMPT=1
echo "[INFO] proxy retry wrapper: max=${MAX}, delay=${DELAY}s"
while [ "$ATTEMPT" -le "$MAX" ]; do
echo "[INFO] starting proxy attempt ${ATTEMPT}/${MAX}"
/usr/local/bin/start-proxy-supervised.sh && exit 0 || true
echo "[WARN] proxy exited (attempt ${ATTEMPT}/${MAX}); sleeping ${DELAY}s before retry"
sleep "$DELAY"
ATTEMPT=$((ATTEMPT+1))
done
echo "[ERROR] proxy failed after ${MAX} attempts"
exit 1