26 lines
1.0 KiB
Python
26 lines
1.0 KiB
Python
#!/usr/bin/env python3
|
|
import paramiko
|
|
|
|
c = paramiko.SSHClient()
|
|
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
c.connect("10.88.0.4", username="eric", password="4669805", timeout=20)
|
|
B = "/home/eric/d2ypp2-src"
|
|
|
|
|
|
def run(cmd: str) -> str:
|
|
_, o, e = c.exec_command(f"export LC_ALL=C.UTF-8; {cmd}", timeout=90, get_pty=True)
|
|
return (o.read() + e.read()).decode("utf-8", "replace")
|
|
|
|
|
|
for label, cmd in [
|
|
("proxychains_nameerror", f"grep -h '_proxychains_config_for_push' {B}/.pm2/logs/youtube2__*-err.log 2>/dev/null | tail -5 || echo none"),
|
|
("duplicate_option", f"grep -h 'DuplicateOptionError' {B}/.pm2/logs/youtube2__*-err.log 2>/dev/null | tail -3 || echo none"),
|
|
("outer_exception", f"grep -h '外层异常' {B}/.pm2/logs/youtube2__*-out.log 2>/dev/null | tail -5 || echo none"),
|
|
("ffmpeg", "pgrep -af 'ffmpeg.*rtmps' | grep -v pgrep | head -3"),
|
|
("recent_out", f"tail -8 {B}/.pm2/logs/youtube2__ch_mpwri36r_z5lm2-out.log 2>/dev/null"),
|
|
]:
|
|
print(f"=== {label} ===")
|
|
print(run(cmd)[:1500])
|
|
print()
|
|
c.close()
|