#!/bin/bash
# Restart the dev API server (uvicorn) detached from the calling shell.
PAT="uvicorn"
pkill -f "python3 -m $PAT app.main" 2>/dev/null
sleep 2
cd /workspace/bulkmailer
setsid nohup python3 -m uvicorn app.main:app --host 0.0.0.0 --port 8000 > /tmp/api.log 2>&1 < /dev/null &
sleep 5
curl -s http://localhost:8000/api/health
echo
