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>
31 lines
1007 B
Python
31 lines
1007 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)
|
|
sftp = c.open_sftp()
|
|
sftp.put(
|
|
r"c:\Users\admin\Desktop\douyinWEB\backend\app\host_metrics.py",
|
|
"/opt/douyinWEB/backend/app/host_metrics.py",
|
|
)
|
|
sftp.close()
|
|
c.exec_command("systemctl restart douyinweb-api", timeout=5)
|
|
time.sleep(6)
|
|
_, o, e = c.exec_command(
|
|
"systemctl is-active douyinweb-api; "
|
|
"cd /opt/douyinWEB/backend && .venv/bin/python -c "
|
|
"\"from app import host_metrics; print(host_metrics.snapshot()); import time; time.sleep(1); print(host_metrics.snapshot())\"",
|
|
timeout=30,
|
|
)
|
|
print(o.read().decode("utf-8", "replace"))
|
|
err = e.read().decode("utf-8", "replace").strip()
|
|
if err:
|
|
print("ERR:", err[:400])
|
|
c.close()
|