#!/bin/sh
set -e

export PYTHONUNBUFFERED=1

# Ensure dashboard.html points to index.html to avoid code duplication
if [ ! -L dashboard.html ] && [ ! -f dashboard.html ]; then
    ln -sf index.html dashboard.html
fi

echo "Starting Mithal website background monitor..."
python3 monitor.py &

echo "Starting Mithal web dashboard on port 8080..."
exec python3 -m http.server 8080
