Skip to content

Commit

Permalink
add retry script
Browse files Browse the repository at this point in the history
  • Loading branch information
MyroTk committed Jan 23, 2025
1 parent 987cc8c commit 2b236e5
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/retry.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash
# Execute command until exitcode is 0 or
# maximum number of retries is reached
# Example:
# ./retry <retries> <delay> <command>
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

0 comments on commit 2b236e5

Please sign in to comment.