#!/usr/bin/env python3 from __future__ import annotations import paramiko from load_dev_env import ssh_config HOST, USER, PASSWORD = ssh_config() CMDS = [ "hostname; free -h | head -2; df -h / | tail -1", "docker --version 2>&1; docker ps --format 'table {{.Names}}\t{{.Status}}\t{{.Ports}}' 2>&1", "ss -ltnp 2>/dev/null | grep -E ':5432|:3306|:9000|:9300|:8090|:4002|:8000|:9180|:9100|:3000|:8080|:1935|:1337|:8025|:9001' || true", "ls /www/server/panel/vhost/nginx/*.conf 2>/dev/null | xargs -I{} basename {}", "ls /etc/systemd/system/*.service 2>/dev/null | xargs -I{} basename {} | grep -E 'nomad|lounge|mirotalk|ergo|cnomad' || true", "which nginx certbot 2>&1", "curl -sI https://nomadro.cn/ | head -3", ] def main() -> None: c = paramiko.SSHClient() c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) c.connect(HOST, username=USER, password=PASSWORD, timeout=25) try: for cmd in CMDS: print(f"\n=== {cmd} ===") _, o, e = c.exec_command(cmd, timeout=45, get_pty=True) out = o.read().decode("utf-8", errors="replace").strip() err = e.read().decode("utf-8", errors="replace").strip() if out: print(out) if err: print("ERR:", err) finally: c.close() if __name__ == "__main__": main()