20 lines
765 B
Python
20 lines
765 B
Python
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 = [
|
|
"sudo ufw status 2>/dev/null || echo ufw_n/a",
|
|
"sudo iptables -L INPUT -n 2>/dev/null | head -15 || true",
|
|
"curl -s http://127.0.0.1:7777/guest-customer-service | grep -o 'guest_new_path[^,]*' | head -1",
|
|
"sudo docker exec guest-chat-postgres-1 psql -U postgres -d chatwoot_production -c 'SELECT count(*) AS accounts FROM accounts;'",
|
|
]
|
|
for cmd in cmds:
|
|
print("===", cmd)
|
|
_, o, e = c.exec_command(cmd, timeout=60)
|
|
print(o.read().decode())
|
|
err = e.read().decode()
|
|
if err:
|
|
print("ERR:", err[:400])
|
|
c.close()
|