Document Caddy domains, SeaweedFS covers, VPS ports, and keep monitor DB current. Co-authored-by: Cursor <cursoragent@cursor.com>
47 lines
1.9 KiB
Python
47 lines
1.9 KiB
Python
# -*- coding: utf-8 -*-
|
|
import paramiko
|
|
|
|
c = paramiko.SSHClient()
|
|
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
c.connect("107.173.30.245", 22, "root", "Xiao4669805", timeout=30, allow_agent=False, look_for_keys=False)
|
|
|
|
cmd = r"""
|
|
set +e
|
|
systemctl is-active douyinweb-api douyinweb-web seaweed-s3 seaweed-master
|
|
ss -lntp | grep -E ':4015|:8014|:8333'
|
|
|
|
# ensure capture enabled + s3 env present
|
|
grep DY_S3 /etc/systemd/system/douyinweb-api.service || true
|
|
cd /opt/douyinWEB/backend
|
|
. .venv/bin/activate
|
|
python - <<'PY'
|
|
from app import db
|
|
db.init_db()
|
|
db.update_settings_map({"capture_cover_on_start": True})
|
|
print("capture", db.get_settings_map().get("capture_cover_on_start"))
|
|
from app.config import settings
|
|
print("s3_enabled_cfg", settings.s3_enabled, settings.s3_endpoint, settings.s3_bucket)
|
|
PY
|
|
|
|
# recapture
|
|
echo '--- recapture ---'
|
|
curl -s --max-time 400 -X POST http://127.0.0.1:8014/api/sessions/active/recapture-covers
|
|
echo
|
|
echo '--- active ---'
|
|
curl -s --max-time 15 http://127.0.0.1:8014/api/sessions/active | python3 -c "
|
|
import sys,json
|
|
d=json.load(sys.stdin)
|
|
print('total', d.get('total'))
|
|
for s in (d.get('sessions') or [])[:8]:
|
|
print(s.get('anchor_name'), '|', s.get('cover_url'), '|', (s.get('cover_path') or '')[:70])
|
|
"
|
|
SID=$(curl -s http://127.0.0.1:8014/api/sessions/active | python3 -c "import sys,json; d=json.load(sys.stdin); ss=d.get('sessions') or []; print(next((x['id'] for x in ss if x.get('cover_path')), ss[0]['id'] if ss else ''))")
|
|
echo SID=$SID
|
|
curl -s -o /dev/null -w 'cover:%{http_code} size:%{size_download}\n' --max-time 20 http://127.0.0.1:8014/api/sessions/$SID/cover
|
|
curl -s -o /dev/null -w 'web:%{http_code}\n' --max-time 15 http://127.0.0.1:4015/
|
|
curl -s -o /dev/null -w 'cover_via_web:%{http_code}\n' --max-time 20 http://127.0.0.1:4015/api/sessions/$SID/cover
|
|
"""
|
|
_, o, _ = c.exec_command(cmd, timeout=500, get_pty=True)
|
|
print(o.read().decode("utf-8", errors="replace")[-8000:])
|
|
c.close()
|