douyinWEB/scripts/_fix_api.py
eric d409e416da Ship physical dual-edge stack, Studio CDP live metrics, and ops tooling.
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>
2026-09-04 22:42:40 -05:00

23 lines
1.0 KiB
Python

import paramiko
import sys
import time
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, t=45):
_, o, e = c.exec_command(cmd, timeout=t)
return (o.read() + e.read()).decode("utf-8", "replace")
print("before:", run("systemctl show douyinweb-api -p ActiveState -p SubState -p MainPID"))
print(run("ps -ef | grep -E 'uvicorn|8014' | grep -v grep || true"))
print(run("systemctl kill -s SIGKILL douyinweb-api || true; sleep 2; systemctl reset-failed douyinweb-api || true; systemctl start douyinweb-api"))
time.sleep(6)
print("after:", run("systemctl is-active douyinweb-api"))
print(run("ss -tlnp | grep 8014 || true"))
print("http:", run("curl -s -m 8 -o /dev/null -w %{http_code} http://127.0.0.1:8014/api/tiktok/status || echo fail"))
print(run("journalctl -u douyinweb-api -n 30 --no-pager | tail -30"))
c.close()