#!/bin/bash # YouTube Summarizer Frontend Restart Script # Kills existing frontend server and starts a new one echo "🔄 Restarting YouTube Summarizer Frontend..." # Kill any existing frontend processes echo "🛑 Stopping existing frontend processes..." # Kill processes on frontend port range (3000-3010) for port in {3000..3010}; do lsof -ti :$port | xargs -r kill -9 2>/dev/null && echo " Killed process on port $port" done # Also kill by process name patterns pkill -f "npm run dev" 2>/dev/null || true pkill -f "vite.*dev" 2>/dev/null || true pkill -f "node.*vite" 2>/dev/null || true # Check if any processes were found if [ $? -eq 0 ]; then echo " Stopped existing frontend processes" else echo " No existing frontend processes found" fi # Wait a moment for processes to terminate sleep 2 # Navigate to frontend directory echo "🚀 Starting frontend server..." cd "$(dirname "$0")/../frontend" || exit 1 # Start the frontend server nohup npm run dev > ../logs/frontend.log 2>&1 & FRONTEND_PID=$! # Wait a moment and check if server started successfully sleep 5 if ps -p $FRONTEND_PID > /dev/null; then echo "✅ Frontend server started successfully (PID: $FRONTEND_PID)" echo "🌐 Frontend running on: http://localhost:3002" echo "🔧 Admin page (no auth): http://localhost:3002/admin" echo "📋 Logs: tail -f logs/frontend.log" else echo "❌ Frontend server failed to start" echo "📋 Check logs: cat logs/frontend.log" exit 1 fi