# -*- coding: utf-8 -*- from __future__ import annotations import sys import time import paramiko sys.stdout.reconfigure(encoding="utf-8", errors="replace") HOST = "107.173.30.245" USER = "root" PASSWORD = "Xiao4669805" c = paramiko.SSHClient() c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) c.connect(HOST, 22, USER, PASSWORD, timeout=30, allow_agent=False, look_for_keys=False) def run(cmd: str, timeout: int = 120) -> str: _, out, err = c.exec_command(cmd, timeout=timeout) return (out.read() + err.read()).decode("utf-8", "replace").strip() print("build_tail:") print(run("tail -n 30 /tmp/fe_build_xclips.log | tr -cd '\\11\\12\\15\\40-\\176'")) c.exec_command("systemctl restart douyinweb-web >/dev/null 2>&1", timeout=5) time.sleep(6) print("web:", run("systemctl is-active douyinweb-web")) print("api:", run("systemctl is-active douyinweb-api")) print("probe:", run("curl -sS -m 10 http://127.0.0.1:8014/api/x-clips/status | tr -cd '\\11\\12\\15\\40-\\176' | head -c 700")) print("db:", run("stat -c '%n %s' /opt/douyinWEB/backend/data/monitor.db")) print("routes:", run("curl -sS -m 5 http://127.0.0.1:8014/openapi.json | tr -cd '\\11\\12\\15\\40-\\176' | grep -o '/api/x-clips/[^\"]*' | sort -u | head")) c.close()