# -*- coding: utf-8 -*- import sys import paramiko sys.stdout.reconfigure(encoding="utf-8", errors="replace") REMOTE = r""" cd /opt/douyinWEB/backend .venv/bin/python - <<'PY' import json from app import db, shorts_pipeline cfg = db.get_settings() print("shorts_enabled", cfg.get("shorts_enabled")) print("worker_running", shorts_pipeline.is_running()) print("channels", len(db.list_shorts_channels(enabled=None))) PY curl -sS -o /dev/null -w "channels=%{http_code}\n" http://127.0.0.1:8014/api/shorts/channels curl -sS -o /dev/null -w "jobs=%{http_code}\n" "http://127.0.0.1:8014/api/shorts/jobs?limit=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) _i, o, e = c.exec_command(REMOTE, timeout=60) print(o.read().decode("utf-8", "replace")) err = e.read().decode("utf-8", "replace").strip() if err: print("ERR", err[:500]) c.close()