Files
vault/.github/scripts/retry-command.sh
Josh Black 56b32081f0 add a retry-command script (#27754)
* add a retry-command script

* add license header to retry script
2024-07-12 13:18:41 -07:00

19 lines
293 B
Bash
Executable File

#!/usr/bin/env bash
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1
set -euo 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 2
done