forked from mtusi2026/mtusi2026lab5
17 lines
489 B
Bash
Executable File
17 lines
489 B
Bash
Executable File
#!/bin/sh
|
|
set -eu
|
|
cd "$(dirname "$0")/.."
|
|
python3 - "${1:-120}" <<'PYTHON'
|
|
import sys,time,urllib.request,urllib.error
|
|
end=time.monotonic()+int(sys.argv[1])
|
|
while time.monotonic()<end:
|
|
try:
|
|
with urllib.request.urlopen('http://localhost:8080/health/ready',timeout=3) as r:
|
|
if r.status==200:
|
|
print('ready');sys.exit(0)
|
|
except (OSError,urllib.error.URLError):
|
|
pass
|
|
time.sleep(1)
|
|
raise SystemExit('API not ready before deadline')
|
|
PYTHON
|