# -*- coding: utf-8 -*- from __future__ import annotations 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("107.173.30.245", 22, "root", "Xiao4669805", timeout=30, allow_agent=False, look_for_keys=False) def run(cmd: str, timeout: int = 30) -> str: _, out, err = c.exec_command(cmd, timeout=timeout) return (out.read() + err.read()).decode("utf-8", "replace").strip() print( run( "grep -E 'S3_|s3_' /opt/douyinWEB/backend/.env /opt/douyinWEB/backend/.env.* 2>/dev/null | " "tr -cd '\\11\\12\\15\\40-\\176' | head -40" ) ) print( run( "cd /opt/douyinWEB && /opt/douyinWEB/backend/.venv/bin/python -c " "\"from backend.app.config import settings; " "print('enabled', settings.s3_enabled); " "print('public', settings.s3_public_base); " "print('endpoint', settings.s3_endpoint); " "print('bucket', settings.s3_bucket)\"" ) ) # recent x2 jobs with media print( run( "cd /opt/douyinWEB && /opt/douyinWEB/backend/.venv/bin/python -c " "\"from backend.app import x2_db; " "st=x2_db.status_snapshot(); " "jobs=st.get('jobs') or []; " "[print(j.get('id'), j.get('kind'), j.get('status'), (j.get('error') or '')[:80], " "str((j.get('params') or {}).get('mediaUrls'))[:120]) " "for j in jobs[:8] if j.get('kind')=='engage.post']\"" ) ) c.close()