sh2/d2ypp2/tools/remote_fix_now.py
2026-06-14 10:41:48 -05:00

44 lines
1.8 KiB
Python

#!/usr/bin/env python3
from __future__ import annotations
import json
import paramiko
HOST, USER, PASS = "10.88.0.4", "eric", "4669805"
def run(c, cmd, timeout=60):
_, o, e = c.exec_command(cmd, timeout=timeout, get_pty=True)
return (o.read() + e.read()).decode("utf-8", "replace")
def main():
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect(HOST, username=USER, password=PASS, timeout=20)
cmds = [
"curl -sS -m 15 'http://127.0.0.1:8001/process_monitor?family=youtube'",
"pgrep -af 'ffmpeg.*rtmps' || echo NO_FFMPEG",
"ps aux | grep 'd2ypp2-src/youtube.py' | grep -v grep",
"head -3 /home/eric/d2ypp2-src/config/URL_config.youtube2__ch_mpwri36r_z5lm2.ini",
"head -3 /home/eric/d2ypp2-src/config/URL_config.youtube2__ch_mpyvqkc0_gj63k.ini",
"grep -E 'stream copy|transcode|speed=|并发|YouTube Live profile' /home/eric/d2ypp2-src/.pm2/logs/youtube2__ch_mpwri36r_z5lm2-out.log | tail -12",
"grep -E 'stream copy|transcode|speed=|并发|YouTube Live profile' /home/eric/d2ypp2-src/.pm2/logs/youtube2__ch_mpyvqkc0_gj63k-out.log | tail -12",
"tail -20 /home/eric/d2ypp2-src/.pm2/logs/youtube2__ch_mpwri36r_z5lm2-out.log",
"tail -20 /home/eric/d2ypp2-src/.pm2/logs/youtube2__ch_mpyvqkc0_gj63k-out.log",
"md5sum /home/eric/d2ypp2-src/douyin_youtube_ffplay.py | head -1",
"grep -c '_use_stream_copy' /home/eric/d2ypp2-src/douyin_youtube_ffplay.py || true",
]
for cmd in cmds:
print(f"\n=== {cmd[:75]} ===")
out = run(c, cmd)
try:
print(out.encode("ascii", "backslashreplace").decode()[:8000])
except Exception:
print(out[:8000])
c.close()
if __name__ == "__main__":
main()