最初版本
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import os, 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 = [
|
||||
"hostname; id; groups",
|
||||
"which docker || true; docker --version 2>&1 || true",
|
||||
"sudo -n docker --version 2>&1 || true",
|
||||
"ss -tlnp 2>/dev/null | grep 7777 || true",
|
||||
"ps aux | grep python | grep -v grep | head -10",
|
||||
"curl -sI http://127.0.0.1:7777/guest-customer-service 2>/dev/null | head -8 || true",
|
||||
]
|
||||
for cmd in cmds:
|
||||
print("===", cmd)
|
||||
_, o, e = c.exec_command(cmd, timeout=30)
|
||||
print(o.read().decode())
|
||||
err = e.read().decode()
|
||||
if err:
|
||||
print("ERR:", err)
|
||||
c.close()
|
||||
Reference in New Issue
Block a user