# -*- coding: utf-8 -*- import paramiko import sys import time if hasattr(sys.stdout, "reconfigure"): sys.stdout.reconfigure(encoding="utf-8", errors="replace") def run(c, cmd, timeout=30): _, o, e = c.exec_command(cmd, timeout=timeout) out = o.read().decode("utf-8", "replace") err = e.read().decode("utf-8", "replace") print(out) if err.strip(): print("ERR", err[:400]) 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) run(c, "systemctl is-active douyinweb-api || systemctl start douyinweb-api; sleep 2; systemctl is-active douyinweb-api") run( c, "cd /opt/douyinWEB/backend && PYTHONPATH=. .venv/bin/python -c \"from app.db import get_room_by_room_id; r=get_room_by_room_id('120371233716'); print(r.get('avatar_url') if r else None)\"", ) run(c, "curl -sI https://dy.nomadro.live/douyin-covers/covers/avatars/120371233716.jpg | head -5") c.close()