douyinWEB/scripts/_diag_dylive_yt_long3.py
2026-09-13 22:10:49 -05:00

32 lines
1.1 KiB
Python

#!/usr/bin/env python3
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)
cmd = r"""
du -xh /opt --max-depth=2 2>/dev/null | sort -h | tail -25
echo ---
du -xh /var/lib/docker --max-depth=1 2>/dev/null | sort -h | tail -10
echo ---
cd /opt/douyinWEB/backend && ./.venv/bin/python - <<'PY'
from app.clip_retention import disk_ok_for_record, disk_free_gb
from app import db
cfg=db.get_settings_map()
print('free_gb', disk_free_gb())
print('clips_min_free_gb', cfg.get('clips_min_free_gb'))
print('disk_ok', disk_ok_for_record(cfg))
PY
echo ---
# why pipeline not running after boot
journalctl -u douyinweb-api --since '2026-09-13 15:00' --no-pager | grep -iE 'yt_long|pipeline|boot' | tail -30
"""
_i, o, e = c.exec_command(cmd, timeout=90)
print(o.read().decode("utf-8", "replace"))
err = e.read().decode("utf-8", "replace")
if err.strip():
print("[stderr]", err[:1000])
c.close()