17 lines
626 B
Python
17 lines
626 B
Python
#!/usr/bin/env python3
|
|
import paramiko
|
|
import sys
|
|
|
|
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
|
c = paramiko.SSHClient()
|
|
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
c.connect("107.173.30.245", 22, "root", "Xiao4669805", timeout=30, allow_agent=False, look_for_keys=False)
|
|
_i, o, e = c.exec_command(
|
|
"systemctl is-active douyinweb-api; "
|
|
"curl -sS -m 8 http://127.0.0.1:8014/api/health | head -c 180; echo; "
|
|
"curl -sS -m 8 -o /dev/null -w 'dylive=%{http_code}\\n' https://dylive.nomadro.com/api/health",
|
|
timeout=40,
|
|
)
|
|
print((o.read() + e.read()).decode("utf-8", "replace"))
|
|
c.close()
|