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>
25 lines
794 B
Python
25 lines
794 B
Python
import paramiko, time
|
|
|
|
HOST = "107.173.30.245"
|
|
USER = "root"
|
|
PASSWORD = "Xiao4669805"
|
|
REPO = "/opt/douyinWEB"
|
|
|
|
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)
|
|
|
|
for label, cmd in [
|
|
("fetch", f"cd {REPO} && git fetch origin 2>&1"),
|
|
("checkout dev", f"cd {REPO} && git checkout dev 2>&1"),
|
|
("branch", f"cd {REPO} && git branch --show-current"),
|
|
("restart api", "systemctl restart douyinweb-api; sleep 5; systemctl is-active douyinweb-api"),
|
|
]:
|
|
_s, out, err = c.exec_command(cmd, timeout=60)
|
|
o = out.read().decode("utf-8", "replace").strip()
|
|
e = err.read().decode("utf-8", "replace").strip()
|
|
print(f"[{label}]", o or e)
|
|
|
|
c.close()
|
|
print("DONE")
|