25 lines
1.3 KiB
Python
25 lines
1.3 KiB
Python
#!/usr/bin/env python3
|
|
import paramiko
|
|
|
|
def q(host, cmd, timeout=30):
|
|
c=paramiko.SSHClient(); c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
c.connect(host,username='eric',password='4669805',timeout=15)
|
|
_,o,e=c.exec_command(cmd,timeout=timeout,get_pty=True)
|
|
out=(o.read()+e.read()).decode('utf-8','replace')
|
|
c.close(); return out
|
|
|
|
for host in ['10.88.0.4','10.88.0.5']:
|
|
print('\n===',host,'===')
|
|
for cmd in [
|
|
'ls -la /opt/live/d2ypp/youtube.py /opt/live/d2ypp/douyin_youtube_ffplay.py 2>&1',
|
|
'systemctl list-units --type=service --state=running 2>/dev/null | grep -Ei \"live|youtube|d2ypp\" || true',
|
|
'cat /home/eric/d2ypp2-src/config/system-stack.env 2>/dev/null | grep -E \"^PORT=|^BASE|^REPO\" || true',
|
|
'cat /opt/live/d2ypp/config/system-stack.env 2>/dev/null | grep -E \"^PORT=\" || true',
|
|
'docker ps --format \"{{.Names}} {{.Status}}\" 2>/dev/null | wc -l',
|
|
'free -h | grep -E \"Mem|Swap\"',
|
|
'curl -sS -m 10 http://127.0.0.1:8001/stack/summary 2>/dev/null | head -c 2000',
|
|
'ls /home/eric/d2ypp2-src/.pm2/pids/*.pid 2>/dev/null | wc -l; cat /home/eric/d2ypp2-src/.pm2/pids/*.pid 2>/dev/null | head -5',
|
|
]:
|
|
print('--',cmd[:60])
|
|
print(q(host,cmd).encode('ascii','backslashreplace').decode()[:2500])
|