From 2b236e50773697a9cc3046b9756bd6404ff09b89 Mon Sep 17 00:00:00 2001 From: MyroTk Date: Wed, 22 Jan 2025 20:18:37 -0500 Subject: [PATCH] add retry script --- .github/retry.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 .github/retry.sh diff --git a/.github/retry.sh b/.github/retry.sh new file mode 100755 index 00000000000..566c2cf1131 --- /dev/null +++ b/.github/retry.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# Execute command until exitcode is 0 or +# maximum number of retries is reached +# Example: +# ./retry +retries=$1 +delay=$2 +command="${@:3}" +exitcode=0 +try=0 +until [ "$try" -ge $retries ] +do + echo "$command" + eval "$command" + exitcode=$? + if [ $exitcode -eq 0 ]; then + break + fi + try=$((try+1)) + sleep $2 +done +exit $exitcode