Skip to content

Commit

Permalink
try startup check up to three times
Browse files Browse the repository at this point in the history
  • Loading branch information
falkoschindler committed Oct 18, 2024
1 parent 219da63 commit f851b69
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions test_startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,21 @@ run() {
check() {
echo "Checking $1 ----------"
pushd "$(dirname "$1")" >/dev/null
if run "$(basename "$1")" "${@:2}"; then
echo "OK --------"
popd > /dev/null
else
echo "FAILED -------"
popd > /dev/null
return 1
fi

max_attempts=3
for attempt in $(seq 1 $max_attempts); do
if run "$(basename "$1")" "${@:2}"; then
echo "OK --------"
popd > /dev/null
return 0
elif [ $attempt -eq $max_attempts ]; then
echo "FAILED after $max_attempts attempts -------"
popd > /dev/null
return 1
else
echo "Attempt $attempt failed. Retrying..."
fi
done
}

check main.py || exit 1
Expand Down

0 comments on commit f851b69

Please sign in to comment.