#!/bin/bash
cd ~/library.mytunnel.ca
source ~/.nvm/nvm.sh

# Load production environment
export $(cat .env.production | xargs)

# Kill any existing process
pkill -f "node.*next.*library.mytunnel.ca" || true

# Start the server in background
nohup node server.js > app.log 2>&1 &

echo "Server started. Check app.log for output."
echo "PID: $!"
