#!/bin/bash
# Script de démarrage pour le scraper Jobs.ch

echo "🚀 Démarrage du serveur web pour l'interface..."

# Vérifier si le port 8080 est libre
if netstat -tuln | grep -q ":8080 "; then
    echo "⚠️ Le port 8080 est déjà utilisé"
    echo "Essayez un autre port ou arrêtez le service qui utilise le port 8080"
    exit 1
fi

# Démarrer le serveur PHP intégré
php -S localhost:8080 -t . > logs/webserver.log 2>&1 &

echo "✅ Serveur démarré sur http://localhost:8080"
echo "📊 Interface disponible à: http://localhost:8080/interface_scraper.php"
echo "🛑 Pour arrêter: kill $(pgrep -f 'php -S localhost:8080')"
