ifixkart-backend/scripts/check_remote_processes.py

23 lines
615 B
Python

import paramiko
host = "80.65.208.73"
user = "root"
password = "G7#Zp9!Qv@M2e$XwR8H^K"
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(host, username=user, password=password, timeout=10)
def run_remote(cmd):
print(f"=== Command: {cmd} ===")
stdin, stdout, stderr = ssh.exec_command(cmd)
out = stdout.read().decode()
err = stderr.read().decode()
print("STDOUT:", out)
if err:
print("STDERR:", err)
return out, err
run_remote("ps aux | grep -E 'uvicorn|fastapi|python'")
run_remote("pm2 describe 2; pm2 describe 3")
ssh.close()