#!/usr/bin/env bash # Run the Arq worker and the FastAPI API in one container. If either exits, the # script exits non-zero so the Space restarts the container (crash recovery). set -uo pipefail arq worker.arq_worker.WorkerSettings & WORKER=$! uvicorn app.main:app --host 0.0.0.0 --port 7860 & API=$! wait -n echo "[start.sh] a process exited — stopping container for restart" kill "$WORKER" "$API" 2>/dev/null || true exit 1