Files
cloud-worker/scripts/pod/start-comfyui.sh
T
2026-08-06 03:23:09 -04:00

27 lines
783 B
Bash
Executable File

#!/bin/bash
# Start ComfyUI headless on the pod, listening on 127.0.0.1:8188.
# Uses tmux when available (attachable session), else nohup.
# Access from your laptop via scripts/local/port-forward.sh
set -euo pipefail
LOG=/workspace/minimax-h3/comfyui.log
# wait out any process that is mid-shutdown before deciding it's "running"
for i in 1 2 3 4 5; do
pgrep -f "python3? main.py" >/dev/null || break
sleep 2
done
if pgrep -f "python3? main.py" >/dev/null; then
echo "ComfyUI already running"
exit 0
fi
if command -v tmux >/dev/null; then
tmux new -s comfyui -d \
"cd /ComfyUI && python3 main.py --listen 127.0.0.1 --port 8188 2>&1 | tee -a $LOG"
else
cd /ComfyUI
nohup python3 main.py --listen 127.0.0.1 --port 8188 >>"$LOG" 2>&1 &
fi
echo "started; tail $LOG"