# -*- 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) cmd = r""" set -e test -f /www/server/panel/vhost/nginx/ypp.smallzhiyuns.com.conf && echo vhost_ok /www/server/nginx/sbin/nginx -t 2>&1 | tail -5 echo --- curl -sS -o /dev/null -w 'local_health:%{http_code}\n' http://127.0.0.1:8014/api/health curl -sS -o /dev/null -w 'local_login:%{http_code}\n' http://127.0.0.1:4015/login curl -sS -o /dev/null -w 'http80:%{http_code}\n' --max-time 15 -H 'Host: ypp.smallzhiyuns.com' http://127.0.0.1/login curl -sS -o /dev/null -w 'https443:%{http_code}\n' --max-time 20 https://ypp.smallzhiyuns.com/login curl -sS -o /dev/null -w 'https_health:%{http_code}\n' --max-time 15 https://ypp.smallzhiyuns.com/api/health echo ---existing--- curl -sS -o /dev/null -w 'gitea:%{http_code}\n' --max-time 10 -H 'Host: gitea.dsx2020.com' http://127.0.0.1/ curl -sS -o /dev/null -w 'miniflux:%{http_code}\n' --max-time 10 -H 'Host: miniflux.smallzhiyuns.com' https://miniflux.smallzhiyuns.com/ -k curl -sS -o /dev/null -w 'ytshort:%{http_code}\n' --max-time 10 -H 'Host: ytshort.smallzhiyuns.com' https://ytshort.smallzhiyuns.com/ -k echo ---units--- systemctl is-active douyinweb-api douyinweb-web douyinweb-pb douyinweb-yt douyinweb-s3 python3 - <<'PY' import sqlite3 p='/opt/douyinWEB/backend/data/monitor.db' c=sqlite3.connect(p) print('admin', c.execute("select value from kv_settings where key='admin_username'").fetchone()) print('rooms', c.execute('select count(*) from rooms').fetchone()[0]) PY """ _, o, e = c.exec_command(cmd, timeout=40) print((o.read() + e.read()).decode("utf-8", "replace")) c.close()