#! /bin/bash
set -e

# Function to clean up background processes
cleanup() {
    echo "Cleaning up background processes..."
    kill $(jobs -p) 2>/dev/null
}

# Trap EXIT and SIGINT (Ctrl-C) to call the cleanup function
trap cleanup EXIT SIGINT

# switch to using the script's current directory:
cd "$(dirname "$0")"


# Start background processes
uvicorn --host 0.0.0.0 --port 80 --workers 8 --forwarded-allow-ips=* statsdashpublic.app:app &

# Wait for all background processes to finish
wait
