#!/bin/bash pid=$(pgrep -f "python.*main.py" | head -1) echo "PID=$pid" if [ -z "$pid" ]; then echo "NO PROCESS" exit 1 fi # Find py-spy PYSPY=$(which py-spy 2>/dev/null || find /home/fabian -name py-spy -type f 2>/dev/null | head -1) if [ -z "$PYSPY" ]; then PYSPY="/home/fabian/ComfyUI/venv/bin/py-spy" fi echo "py-spy=$PYSPY" # Get stack trace sudo $PYSPY dump --pid $pid 2>&1 | head -80 echo "" echo "=== Process stats ===" ps -p $pid -o pid,pcpu,pmem,rss,etime 2>/dev/null