Files
lochuan e093d74e0a openpilot v2026.003.000 lean release (device-built, flat)
date: 2026-10-25T03:40:59
source commit: c3xl-lean@b13531ea3f789dc796a77901d5ff912baa85a1ac
built on: comma device
2026-10-25 03:40:59 +00:00

28 lines
511 B
Bash
Executable File

#!/usr/bin/env bash
function fail {
echo $1 >&2
exit 1
}
function retry {
local n=1
local max=3 # 3 retries before failure
local delay=5 # delay between retries, 5 seconds
while true; do
echo "Running command '$@' with retry, attempt $n/$max"
"$@" && break || {
if [[ $n -lt $max ]]; then
((n++))
sleep $delay;
else
fail "The command has failed after $n attempts."
fi
}
done
}
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
retry "$@"
fi