vault/.github/scripts/retry-command.sh
2026-05-11 04:50:47 +00:00

19 lines
298 B
Bash
Executable File

#!/usr/bin/env bash
# Copyright IBM Corp. 2026, 2025
# SPDX-License-Identifier: BUSL-1.1
set -uo pipefail
tries=5
count=0
until "$@"
do
if [ $count -eq $tries ]; then
echo "tried $count times, exiting"
exit 1
fi
((count++))
echo "trying again, attempt $count"
sleep $count
done