#!/bin/bash
# Quick status check - is the process still running & making progress?
echo "=== Process ==="
ps aux | grep "main.py" | grep -v grep

echo ""
echo "=== Memory usage (RSS in MB) ==="
pid=$(pgrep -f "python.*main.py" | head -1)
if [ -n "$pid" ]; then
    echo "PID: $pid"
    cat /proc/$pid/status 2>/dev/null | grep -E "VmRSS|VmSwap|VmSize|Threads"
    echo ""
    echo "=== GPU memory (rocm-smi) ==="
    rocm-smi --showmeminfo vram 2>/dev/null | head -10
    echo ""
    echo "=== Last 25 lines of log ==="
    tail -25 /home/fabian/comfyui8.log 2>/dev/null
    echo ""
    echo "=== Output files ==="
    ls -la /home/fabian/ComfyUI/output/ 2>/dev/null
else
    echo "NO COMFYUI PROCESS RUNNING"
    echo ""
    echo "=== Last 30 lines of log ==="
    tail -30 /home/fabian/comfyui8.log 2>/dev/null
    echo ""
    echo "=== Output files ==="
    ls -la /home/fabian/ComfyUI/output/ 2>/dev/null
fi
