# -*- coding: utf-8 -*- import sys import time import paramiko sys.stdout.reconfigure(encoding="utf-8", errors="replace") cmds = [ "systemctl is-active douyinweb-api; sleep 3; systemctl is-active douyinweb-api", "curl -sS -o /dev/null -w 'health=%{http_code}\n' http://127.0.0.1:8014/api/health", "timeout 15 bash -c \"printf 's3.bucket.access -name douyin-covers -user anonymous -access Read,List\\nexit\\n' | /opt/seaweedfs/weed shell -master=127.0.0.1:9333\" 2>&1 | tail -12", "curl -sS -o /dev/null -w 's3_anon=%{http_code} sz=%{size_download}\n' http://127.0.0.1:8333/douyin-covers/covers/5d3e14cd-8c13-4b7c-9522-e44dc1cad31e.jpg", "curl -sS -o /dev/null -w 'covers_slash=%{http_code}\n' -k https://127.0.0.1/covers/ -H 'Host: dy.nomadro.live' -L", ] c = paramiko.SSHClient() c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) c.connect("108.174.50.68", 22, "root", "Xiao4669805", timeout=45, allow_agent=False, look_for_keys=False) for cmd in cmds: print("\n===", cmd[:70], "===") _i, o, e = c.exec_command(cmd, timeout=40) print(o.read().decode("utf-8", "replace")) er = e.read().decode("utf-8", "replace").strip() if er: print("ERR", er[:300]) c.close()