#!/bin/bash
# Restart canteen-asset-tracker server
cd /home/oplabs/projects/canteen-asset-tracker

# Kill existing server
pkill -f "python.*server.py" 2>/dev/null || true
sleep 1

# Activate venv and start
source .venv/bin/activate
nohup python server.py > /tmp/canteen-server.log 2>&1 &
echo "Server PID: $!"
sleep 3

# Check health
curl -s http://localhost:8901/health 2>/dev/null || curl -s http://localhost:8900/health 2>/dev/null || echo "Health check failed"
