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>
27 lines
853 B
Python
27 lines
853 B
Python
import paramiko
|
|
import time
|
|
|
|
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, timeout=120):
|
|
_, out, err = c.exec_command(cmd, timeout=timeout)
|
|
return (out.read() + err.read()).decode("utf-8", "replace")
|
|
|
|
|
|
print("status:", run("systemctl is-active douyinweb-api; systemctl is-active douyinweb-web"))
|
|
print(
|
|
"pipsocks:",
|
|
run(
|
|
"/opt/douyinWEB/backend/.venv/bin/pip install -q 'PySocks>=1.7.1' && "
|
|
"/opt/douyinWEB/backend/.venv/bin/python -c 'import socks; print(\"socks ok\")'"
|
|
),
|
|
)
|
|
print(run("systemctl restart douyinweb-api"))
|
|
time.sleep(6)
|
|
print("api:", run("systemctl is-active douyinweb-api"))
|
|
print("web:", run("systemctl is-active douyinweb-web"))
|
|
c.close()
|