#!/bin/bash # # Restart IDS Frontend (Node.js/Express/Vite) # Utility per restart manuale del server frontend # set -e echo "πŸ”„ Restart Frontend Node.js..." # Kill processi Vite esistenti echo "⏸️ Stopping existing processes..." pkill -f "vite" 2>/dev/null || true pkill -f "npm run dev" 2>/dev/null || true sleep 2 # Verifica porta 5000 libera if lsof -Pi :5000 -sTCP:LISTEN -t >/dev/null 2>&1; then echo "⚠️ Porta 5000 occupata, killing processo..." lsof -ti:5000 | xargs kill -9 2>/dev/null || true sleep 1 fi # Restart usando check_frontend.sh echo "πŸš€ Starting frontend..." /opt/ids/deployment/check_frontend.sh # Attendi avvio sleep 3 # Verifica if pgrep -f "vite" > /dev/null; then PID=$(pgrep -f "vite") echo "βœ… Frontend avviato con PID: $PID" echo "πŸ“‘ Server disponibile su: http://localhost:5000" else echo "❌ Errore: Frontend non avviato!" echo "πŸ“‹ Controlla log: tail -f /var/log/ids/frontend.log" exit 1 fi