douyinWEB/scripts/_vps_stop_wgeasy_safe.py
eric d409e416da Ship physical dual-edge stack, Studio CDP live metrics, and ops tooling.
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>
2026-09-04 22:42:40 -05:00

46 lines
1.7 KiB
Python

# -*- coding: utf-8 -*-
"""Inspect VPS live services + stop crash-looping wg-easy ONLY. No other restarts."""
import sys
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=25, allow_agent=False, look_for_keys=False)
def run(cmd, timeout=60):
_, o, e = c.exec_command(cmd, timeout=timeout)
out = (o.read() + e.read()).decode("utf-8", "replace")
print(out)
return out
print("=== live health BEFORE ===")
run(
"systemctl is-active caddy sing-box frp-panel docker; "
"curl -sS -m 8 -o /dev/null -w 'dylive:%{http_code}\\n' https://dylive.nomadro.com/api/health; "
"curl -sS -m 8 -o /dev/null -w 'dylive_login:%{http_code}\\n' https://dylive.nomadro.com/login; "
"docker ps --format '{{.Names}} {{.Status}}' | grep -v wg-easy"
)
print("=== wg-easy why crash ===")
run("docker logs --tail 40 wg-easy 2>&1; echo '---compose---'; cat /opt/wg-easy/docker-compose.yml")
run("ss -ulnp | grep 51820 || echo 'udp 51820 free'; ls /etc/wireguard 2>/dev/null; command -v wg; lsmod | grep wireguard || true")
print("=== stop ONLY wg-easy (isolated compose) ===")
run(
"cd /opt/wg-easy && docker compose stop && docker compose rm -f; "
"docker ps -a --filter name=wg-easy --format '{{.Names}} {{.Status}}'; "
"echo stopped_wg_easy"
)
print("=== live health AFTER stop ===")
run(
"systemctl is-active caddy sing-box docker; "
"curl -sS -m 8 -o /dev/null -w 'dylive:%{http_code}\\n' https://dylive.nomadro.com/api/health; "
"docker ps --format '{{.Names}} {{.Status}}'"
)
c.close()