#!/usr/bin/env python3 import paramiko HOST, USER, PASS = "10.88.0.3", "eric", "Xiao4669805" REMOTE = r''' import os, subprocess pid=3775019 for cmd in [ f"systemctl status live-console.service 2>/dev/null | head -20", f"cat /proc/{pid}/cgroup 2>/dev/null", f"readlink -f /proc/{pid}/fd/1 /proc/{pid}/fd/2 2>/dev/null", f"ls -la /proc/{pid}/fd/ 2>/dev/null | head -30", "find /opt/live/d2ypp -name '*.log' -size +0 2>/dev/null", "find /var/log -name '*youtube*' -o -name '*live*' 2>/dev/null | head -20", "grep -r '正在录制 1 路' /opt/live/d2ypp/logs /opt/live/d2ypp/.pm2/logs /var/log 2>/dev/null | tail -5", ]: print('===', cmd[:90], '===') try: print(subprocess.check_output(cmd, shell=True, text=True, errors='replace')[:4000]) except Exception as e: print('ERR', e) # search big log files for morning recording with 2:05 duration import glob, re from datetime import datetime for path in glob.glob('/opt/live/d2ypp/**', recursive=True): try: if not os.path.isfile(path) or os.path.getsize(path) < 100: continue if os.path.getsize(path) > 20_000_000: continue with open(path,'r',errors='replace') as f: txt=f.read() if '正在录制 1 路' in txt and '2026-06-24T0' in txt: for line in txt.split('\n'): if '正在录制 1 路' in line and ('06:' in line or '07:' in line or '08:' in line): if '原画 2:0' in line or '原画 2:1' in line or '原画 2:05' in line or '原画 2:04' in line: print('HIT', path) print(line[:250]) except: pass ''' def main(): c=paramiko.SSHClient(); c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) c.connect(HOST, username=USER, password=PASS, timeout=15) _,o,e=c.exec_command(f"python3 - <<'PY'\n{REMOTE}\nPY", timeout=180, get_pty=True) import sys; sys.stdout.buffer.write((o.read()+e.read())[:30000]) c.close() if __name__=='__main__': main()