Capture Neko/WG/network hubs, Studio viewer charts, physical deploy docs, and one-shot scripts so VPS vs physical can be toggled later without losing WIP. Co-authored-by: Cursor <cursoragent@cursor.com>
31 lines
1.1 KiB
Python
31 lines
1.1 KiB
Python
# -*- coding: utf-8 -*-
|
|
import sys
|
|
import paramiko
|
|
|
|
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
|
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)
|
|
|
|
def run(cmd, timeout=120):
|
|
_, o, e = c.exec_command(cmd, timeout=timeout)
|
|
out = (o.read() + e.read()).decode("utf-8", "replace").strip()
|
|
print(out[-5000:] if len(out) > 5000 else out, flush=True)
|
|
return out
|
|
|
|
API = "http://127.0.0.1:8014"
|
|
print("[status]", run(f"curl -sS -m 20 {API}/api/yt-long/status"))
|
|
print("[start]", run(f"curl -sS -m 20 -X POST {API}/api/yt-long/start"))
|
|
print("[sample]", run(f"curl -sS -m 90 -X POST {API}/api/yt-long/sample-now"))
|
|
print("[jobs]", run(f'curl -sS -m 20 "{API}/api/yt-long/jobs?limit=10"'))
|
|
print("[db jobs]")
|
|
print(run(r"""cd /opt/douyinWEB/backend && .venv/bin/python - <<'PY'
|
|
from app import db, yt_long_db
|
|
db.init_db()
|
|
jobs = yt_long_db.list_yt_long_jobs(limit=20)
|
|
print('count', len(jobs))
|
|
for j in jobs:
|
|
print(j.get('status'), j.get('anchor_name'), (j.get('error') or '')[:80])
|
|
PY"""))
|
|
c.close()
|