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>
30 lines
1000 B
Python
30 lines
1000 B
Python
#!/usr/bin/env python3
|
|
import sys
|
|
import time
|
|
import paramiko
|
|
|
|
if hasattr(sys.stdout, "reconfigure"):
|
|
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=45, allow_agent=False, look_for_keys=False)
|
|
|
|
# non-blocking restart
|
|
c.exec_command("systemctl restart douyinweb-api", timeout=5)
|
|
time.sleep(8)
|
|
_, o, _ = c.exec_command("systemctl is-active douyinweb-api", timeout=15)
|
|
print("api:", o.read().decode().strip())
|
|
|
|
_, o, e = c.exec_command("cd /opt/douyinWEB/frontend && npm run build 2>&1 | tail -15", timeout=600)
|
|
print(o.read().decode("utf-8", "replace"))
|
|
err = e.read().decode("utf-8", "replace").strip()
|
|
if err:
|
|
print("ERR:", err[:400])
|
|
|
|
c.exec_command("systemctl restart douyinweb-web", timeout=5)
|
|
time.sleep(4)
|
|
_, o, _ = c.exec_command("systemctl is-active douyinweb-web", timeout=15)
|
|
print("web:", o.read().decode().strip())
|
|
c.close()
|