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>
36 lines
1.0 KiB
Python
36 lines
1.0 KiB
Python
# -*- coding: utf-8 -*-
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
import time
|
|
|
|
import paramiko
|
|
|
|
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: str, timeout: int = 120) -> str:
|
|
_, out, err = c.exec_command(cmd, timeout=timeout)
|
|
return (out.read() + err.read()).decode("utf-8", "replace").strip()
|
|
|
|
|
|
print(
|
|
run(
|
|
"cd /opt/douyinWEB && git pull --ff-only origin test1 && "
|
|
"git log -1 --format='%h' "
|
|
)
|
|
)
|
|
c.exec_command("systemctl restart douyinweb-api >/dev/null 2>&1", timeout=5)
|
|
for i in range(15):
|
|
st = run("systemctl is-active douyinweb-api")
|
|
print("api", i, st)
|
|
if st == "active":
|
|
break
|
|
time.sleep(2)
|
|
print("ver", run("python3 -c \"import json;print(json.load(open('/opt/douyinWEB/extensions/dylive-helper/manifest.json'))['version'])\""))
|
|
c.close()
|