最初版本
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import os
|
||||
import sys
|
||||
import paramiko
|
||||
|
||||
pw = os.environ["DEPLOY_PASSWORD"]
|
||||
c = paramiko.SSHClient()
|
||||
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
c.connect("20.191.152.26", username="wakka", password=pw, timeout=30)
|
||||
cmds = [
|
||||
"sudo docker ps -a --filter name=guest-chat --format '{{.Status}}'",
|
||||
"sudo docker logs --tail 40 guest-chat 2>&1",
|
||||
"ss -tlnp | grep 7777 || true",
|
||||
"curl -s -o /dev/null -w 'guest:%{http_code}\\n' http://127.0.0.1:7777/guest-customer-service || echo curl_fail",
|
||||
]
|
||||
for cmd in cmds:
|
||||
print("====", cmd)
|
||||
_, o, e = c.exec_command(cmd, timeout=60)
|
||||
print(o.read().decode("utf-8", "replace"))
|
||||
err = e.read().decode("utf-8", "replace")
|
||||
if err:
|
||||
print("ERR", err[:500])
|
||||
c.close()
|
||||
Reference in New Issue
Block a user