This captures the current live stack updates across the API, Linux service scripts, tests, diagnostics, and exported console assets so the Ubuntu deployment can pull a consistent test3 build. Co-authored-by: Cursor <cursoragent@cursor.com>
58 lines
2.7 KiB
Python
58 lines
2.7 KiB
Python
#!/usr/bin/env python3
|
|
"""Deep query 10.88.0.3 for lane1 history and douyin source."""
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import paramiko
|
|
|
|
HOST, USER, PASS = "10.88.0.3", "eric", "Xiao4669805"
|
|
BASE = "/home/eric/d2ypp2-src"
|
|
|
|
|
|
def q(cmd: str, timeout: int = 120) -> str:
|
|
c = paramiko.SSHClient()
|
|
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
c.connect(HOST, username=USER, password=PASS, timeout=15)
|
|
_, o, e = c.exec_command(cmd, timeout=timeout, get_pty=True)
|
|
out = (o.read() + e.read()).decode("utf-8", "replace")
|
|
c.close()
|
|
return out
|
|
|
|
|
|
CMDS = [
|
|
("pm2_full", f"PM2_HOME={BASE}/.pm2 pm2 jlist 2>/dev/null"),
|
|
("pm2_desc", f"PM2_HOME={BASE}/.pm2 pm2 describe youtube 2>/dev/null; PM2_HOME={BASE}/.pm2 pm2 describe youtube2__ch_mpykhmnj_lsrv7 2>/dev/null"),
|
|
("youtube_ini", f"cat {BASE}/config/youtube.ini 2>/dev/null; echo '---'; cat {BASE}/config/url.ini 2>/dev/null; echo '---'; ls -la {BASE}/config/*.ini 2>/dev/null"),
|
|
("hub_files", f"find {BASE} -type f \\( -name '*.db' -o -name '*youtube*' -o -name '*hub*' \\) 2>/dev/null | head -40"),
|
|
("grep_all_logs", f"grep -rE 'live.douyin.com|source_url|source_room|线路|lane' {BASE}/.pm2/logs {BASE}/logs 2>/dev/null | tail -100"),
|
|
("youtube_events", "curl -sS -m 20 'http://127.0.0.1:8001/hub/youtube-events?limit=50' 2>/dev/null | head -c 15000"),
|
|
("hub_channels", "curl -sS -m 20 'http://127.0.0.1:8001/hub/youtube-pro-channels' 2>/dev/null | head -c 15000"),
|
|
("state_json", f"cat {BASE}/.process_runner/state.json 2>/dev/null | head -c 8000"),
|
|
("ffmpeg_cmd", "ps aux | grep -E 'ffmpeg|youtube.py' | grep -v grep"),
|
|
("log_sizes", f"find {BASE}/.pm2/logs {BASE}/logs -type f -name '*.log' -printf '%T@ %TY-%Tm-%Td %TH:%TM %p %s\\n' 2>/dev/null | sort -nr | head -30"),
|
|
("youtube_out_log", f"tail -200 {BASE}/.pm2/logs/youtube-out.log 2>/dev/null; tail -200 {BASE}/logs/youtube.log 2>/dev/null"),
|
|
("grep_duration", f"grep -rE '125|2:05|2小时|7650|7500|session|duration|started|stopped' {BASE}/.pm2/logs {BASE}/logs 2>/dev/null | tail -50"),
|
|
]
|
|
|
|
|
|
def main() -> int:
|
|
for label, cmd in CMDS:
|
|
print(f"\n{'='*60}\n=== {label} ===\n{'='*60}")
|
|
try:
|
|
out = q(cmd)
|
|
# try pretty json
|
|
if label in ("youtube_events", "hub_channels", "pm2_full", "state_json") and out.strip().startswith(("{", "[")):
|
|
try:
|
|
print(json.dumps(json.loads(out), ensure_ascii=False, indent=2)[:15000])
|
|
continue
|
|
except Exception:
|
|
pass
|
|
print(out[:15000].encode("ascii", "backslashreplace").decode())
|
|
except Exception as exc:
|
|
print(f"ERR: {exc}")
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|