# -*- 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("108.174.50.68", 22, "root", "Xiao4669805", timeout=60, allow_agent=False, look_for_keys=False) cmds = [ "systemctl is-active douyinweb-api douyinweb-web nginx 2>&1", "systemctl status douyinweb-api --no-pager -l 2>&1 | tail -30", "journalctl -u douyinweb-api -n 60 --no-pager 2>&1", "curl -sS -o /dev/null -w 'api8014:%{http_code}' --max-time 5 http://127.0.0.1:8014/api/health; echo", "ss -tlnp | grep 8014 || true", "python3 -m py_compile /opt/douyinWEB/backend/app/db.py 2>&1", "python3 -m py_compile /opt/douyinWEB/backend/app/douyin_live.py 2>&1", "python3 -m py_compile /opt/douyinWEB/backend/app/youtube_relay_pipeline.py 2>&1", ] for cmd in cmds: print("===", cmd, "===") _, o, e = c.exec_command(cmd, timeout=90) out = o.read().decode() err = e.read().decode() if out.strip(): print(out) if err.strip(): print("ERR:", err) c.close()