#!/bin/bash # Start GoMag Import Manager - WSL/Linux cd "$(dirname "$0")" # Create venv if it doesn't exist if [ ! -d "venv" ]; then echo "Creating virtual environment..." python3 -m venv venv fi # Activate venv source venv/bin/activate # Install/update dependencies if needed if [ api/requirements.txt -nt venv/.deps_installed ] || [ ! -f venv/.deps_installed ]; then echo "Installing dependencies..." pip install -r api/requirements.txt touch venv/.deps_installed fi # Stop any existing instance on port 5003 EXISTING_PID=$(lsof -ti tcp:5003 2>/dev/null) if [ -n "$EXISTING_PID" ]; then echo "Stopping existing process on port 5003 (PID $EXISTING_PID)..." kill "$EXISTING_PID" sleep 2 fi # Oracle config export TNS_ADMIN="$(pwd)/api" export LD_LIBRARY_PATH=/opt/oracle/instantclient_21_15:$LD_LIBRARY_PATH cd api echo "Starting GoMag Import Manager on http://0.0.0.0:5003" python -m uvicorn app.main:app --host 0.0.0.0 --port 5003