Files
mtusi2026lab4/scripts/wait_ready.sh
T
2026-11-05 13:52:11 +03:00

13 lines
369 B
Bash
Executable File

#!/bin/sh
cd "$(dirname "$0")/.."
limit="${1:-120}"
end=$(( $(date +%s) + limit ))
while [ "$(date +%s)" -lt "$end" ]; do
if [ "$(curl -s -o /dev/null -w '%{http_code}' localhost:8080/health/ready)" = 200 ] \
&& python3 scripts/upload_tools.py roundtrip >/dev/null 2>&1; then
echo "ready"; exit 0
fi
sleep 2
done
echo "NOT READY after ${limit}s"; exit 1