# -*- coding: utf-8 -*- import paramiko c = paramiko.SSHClient() c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) c.connect("107.173.30.245", 22, "root", "Xiao4669805", timeout=30, allow_agent=False, look_for_keys=False) _, o, _ = c.exec_command(""" systemctl restart douyinweb-web sleep 4 systemctl --no-pager status douyinweb-web | head -20 ss -lntp | grep 4014 curl -s -o /dev/null -w 'web:%{http_code}\n' --max-time 15 http://127.0.0.1:4014/ curl -s -o /dev/null -w 's3:%{http_code}\n' --max-time 10 http://127.0.0.1:8333/douyin-covers/covers/2d969f0e-ba00-4843-a57a-742710814cec.jpg # make bucket publicly readable via seaweed if needed """, timeout=60, get_pty=True) print(o.read().decode()) c.close()