Files
SnarfCode/scripts/check_gotify_discord.py

29 lines
807 B
Python

import paramiko
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect('140.44.4.71', username='snarf', password='Katzir476!', timeout=10)
def run(cmd):
full_cmd = f"echo Katzir476! | sudo -S sh -c '{cmd}'"
_, o, e = c.exec_command(full_cmd)
return o.read().decode().strip(), e.read().decode().strip()
print("=== GOTIFY DISCORD BRIDGE LOGS ===")
cid, _ = run("docker ps -q -f name=gotify-discord-bridge")
if cid:
logs, _ = run(f"docker logs {cid} --tail=100")
print(logs)
else:
print("Bridge container not found!")
print("\n=== GOTIFY SERVER RECENT MESSAGES ===")
# Check messages inside Gotify DB or logs
gid, _ = run("docker ps -q -f name=gotify_gotify")
if gid:
logs, _ = run(f"docker logs {gid} --tail=50")
print(logs)
c.close()