34 lines
1.0 KiB
Python
34 lines
1.0 KiB
Python
import paramiko
|
|
|
|
client = paramiko.SSHClient()
|
|
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
client.connect('152.136.232.83', port=22, username='root', password='Jianhua105', timeout=10)
|
|
|
|
def run(cmd):
|
|
print(f"\n>>> {cmd[:120]}")
|
|
stdin, stdout, stderr = client.exec_command(cmd, timeout=15)
|
|
out = stdout.read().decode('utf-8', errors='replace').strip()
|
|
err = stderr.read().decode('utf-8', errors='replace').strip()
|
|
if out: print(out[-800:])
|
|
if err: print(f"ERR: {err[-200:]}")
|
|
return out
|
|
|
|
# Check who's on port 3002
|
|
run("lsof -i :3002 2>/dev/null || ss -tlnp | grep 3002")
|
|
|
|
# Check ai-video error log
|
|
run("pm2 logs ai-video --lines 30 --nostream 2>/dev/null")
|
|
|
|
# The actual process running zhinengtiapp
|
|
run("ps aux | grep zhinengtiapp | grep -v grep")
|
|
|
|
# Check what pm2 ai-video runs
|
|
run("pm2 show 1 2>/dev/null | head -20")
|
|
|
|
# Restart ai-video
|
|
run("pm2 restart ai-video 2>/dev/null")
|
|
run("sleep 3 && pm2 list")
|
|
run("sleep 1 && curl -s http://localhost:3002/api/system/config/public | head -200")
|
|
|
|
client.close()
|