#!/bin/bash
echo "=== Log tail ==="
tail -10 /home/fabian/comfyui7.log
echo ""
echo "=== Log size ==="
wc -c /home/fabian/comfyui7.log
echo ""
echo "=== RAM ==="
free -h | head -2
echo ""
echo "=== ComfyUI process ==="
PID=$(pgrep -f 'python main.py' | head -1)
if [ -n "$PID" ]; then
    ps -p $PID -o pid,pcpu,pmem,vsz,rss --no-header
    echo "Status: $(cat /proc/$PID/status 2>/dev/null | grep -E 'State|VmRSS|VmSwap' | tr '\n' ' ')"
else
    echo "NOT RUNNING"
fi
echo ""
echo "=== Swap ==="
swapon --show 2>/dev/null || echo "No swap"
echo ""
echo "=== dmesg OOM? ==="
dmesg -T 2>/dev/null | grep -i 'oom\|killed' | tail -5
