Files
storyforge/scripts/status_douyin_workbench.sh

24 lines
557 B
Bash
Executable File

#!/bin/sh
set -eu
PORT="${DOUYIN_WORKBENCH_PORT:-3618}"
SESSION_NAME="${DOUYIN_WORKBENCH_SESSION:-storyforge-douyin-workbench}"
if ! lsof -nP -iTCP:"$PORT" -sTCP:LISTEN >/dev/null 2>&1; then
echo "douyin workbench stopped"
exit 1
fi
screen -ls | grep "$SESSION_NAME" || true
echo "---"
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