21 lines
432 B
Bash
Executable File
21 lines
432 B
Bash
Executable File
#!/bin/sh
|
|
set -eu
|
|
|
|
PORT="${DOUYIN_WORKBENCH_PORT:-3618}"
|
|
|
|
if ! lsof -nP -iTCP:"$PORT" -sTCP:LISTEN >/dev/null 2>&1; then
|
|
echo "douyin workbench stopped"
|
|
exit 1
|
|
fi
|
|
|
|
python3 - <<'PY'
|
|
import os
|
|
import urllib.request
|
|
|
|
port = os.environ.get("PORT", "3618")
|
|
for path in ("/workbench", "/"):
|
|
url = f"http://127.0.0.1:{port}{path}"
|
|
with urllib.request.urlopen(url, timeout=5) as resp:
|
|
print(f"{path}: {resp.status}")
|
|
PY
|