# -*- coding: utf-8 -*- 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("192.227.152.110", 22, "root", "Leaf448772566", timeout=30, allow_agent=False, look_for_keys=False) cmds = [ "systemctl is-active douyinweb-sw-master douyinweb-sw-volume douyinweb-sw-filer douyinweb-s3 douyinweb-pb douyinweb-yt douyinweb-api douyinweb-web 2>&1", "journalctl -u douyinweb-sw-master -u douyinweb-sw-volume -u douyinweb-sw-filer -u douyinweb-s3 -n 40 --no-pager 2>&1", "ss -lntp | grep -E '4015|8014|8092|8020|8333|19333|18080|18888' || true", "test -f /www/server/panel/vhost/nginx/ypp.smallzhiyuns.com.conf && echo vhost_yes || echo vhost_no", # existing services still up? "systemctl is-active nginx 2>/dev/null; ss -lntp | grep -E ':80 |:443 ' | head -3; docker ps --format '{{.Names}}' | head -5", ] for cmd in cmds: print("\n=====", cmd[:80], "=====") _, o, e = c.exec_command(cmd, timeout=25) print((o.read() + e.read()).decode("utf-8", "replace")[-5000:]) c.close()