#!/bin/bash
# Startup script for Vehicle Dashboard

echo "Vehicle Dashboard Startup Script"
echo "================================"

# Check if the vehicle database exists
if [ ! -f "../vehicle_database/vehicle_database.db" ]; then
    echo "Error: Vehicle database not found!"
    echo "Please make sure you have created the vehicle database first."
    exit 1
fi

echo "Vehicle database found."

# Check if Flask is available
if python3 -c "import flask" &> /dev/null; then
    echo "Flask is available."
else
    echo "Installing Flask..."
    sudo apt-get update
    sudo apt-get install -y python3-flask
fi

echo "Starting Vehicle Dashboard Server..."
echo "Access the dashboard at: http://localhost:5000"
echo "Press Ctrl+C to stop the server."

cd /home/Autopartes/dashboard
python3 server.py