最初版本
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import os
|
||||
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 = [
|
||||
"curl -sI http://127.0.0.1:7777/guest-customer-service | head -5",
|
||||
"getent hosts test.pubuli.com || nslookup test.pubuli.com 2>/dev/null | tail -3",
|
||||
"ssh -o BatchMode=yes -o ConnectTimeout=5 -o StrictHostKeyChecking=no wakka@100.31.73.254 hostname 2>&1",
|
||||
"ssh -o BatchMode=yes -o ConnectTimeout=5 -o StrictHostKeyChecking=no root@100.31.73.254 hostname 2>&1",
|
||||
"curl -sI --connect-timeout 5 http://100.31.73.254:7777/guest-customer-service 2>&1 | head -5",
|
||||
]
|
||||
|
||||
for cmd in cmds:
|
||||
print("===", cmd[:90])
|
||||
_, o, e = c.exec_command(cmd, timeout=30)
|
||||
out = o.read().decode()
|
||||
err = e.read().decode()
|
||||
if out:
|
||||
print(out)
|
||||
if err.strip():
|
||||
print("ERR:", err[:200])
|
||||
|
||||
c.close()
|
||||
Reference in New Issue
Block a user