27 lines
900 B
Python
27 lines
900 B
Python
#!/usr/bin/env python3
|
|
import paramiko
|
|
|
|
HOST, USER, PASS, BASE = "10.88.0.4", "eric", "4669805", "/home/eric/d2ypp2-src"
|
|
c = paramiko.SSHClient()
|
|
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
c.connect(HOST, username=USER, password=PASS, timeout=20)
|
|
|
|
|
|
def run(cmd: str, timeout: int = 120) -> str:
|
|
_, o, e = c.exec_command(cmd, timeout=timeout, get_pty=True)
|
|
return (o.read() + e.read()).decode("utf-8", "replace")
|
|
|
|
|
|
for cmd in [
|
|
"systemctl is-active live-console.service",
|
|
"systemctl status live-console.service --no-pager -n 30",
|
|
"journalctl -u live-console.service -n 50 --no-pager",
|
|
f"cd {BASE} && . .venv/bin/activate && python -m py_compile web.py douyin_youtube_ffplay.py youtube.py",
|
|
f"grep relay_strategy {BASE}/config/hardware-profile.json 2>/dev/null || echo no_relay",
|
|
]:
|
|
print("===", cmd[:100])
|
|
print(run(cmd)[:4000])
|
|
print()
|
|
|
|
c.close()
|