# -*- coding: utf-8 -*- import paramiko import sys from pathlib import Path if hasattr(sys.stdout, "reconfigure"): sys.stdout.reconfigure(encoding="utf-8", errors="replace") ROOT = Path(__file__).resolve().parents[1] 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) sftp = c.open_sftp() data = (ROOT / "scripts/_diag_yt_avatars.py").read_bytes().replace(b"\r\n", b"\n") with sftp.file("/tmp/_diag_yt_avatars.py", "wb") as f: f.write(data) sftp.close() def run(cmd, timeout=60): _, o, e = c.exec_command(cmd, timeout=timeout) print(o.read().decode("utf-8", "replace")) err = e.read().decode("utf-8", "replace") if err.strip(): print("ERR", err[:800]) run("cd /opt/douyinWEB/backend && PYTHONPATH=. .venv/bin/python /tmp/_diag_yt_avatars.py") run("curl -sI 'https://dy.nomadro.live/douyin-covers/youtube/avatars/' 2>/dev/null | head -3; ls /opt/douyinWEB/backend/data/covers 2>/dev/null | head -3") # sample one object if any run("aws --endpoint-url http://127.0.0.1:8333 s3 ls s3://douyin-covers/youtube/avatars/ 2>&1 | head -10 || true") c.close()