youtube-summarizer/scripts/restart-both.sh

43 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
# YouTube Summarizer Full Stack Restart Script
# Restarts both backend and frontend servers
echo "🔄 Restarting YouTube Summarizer Full Stack..."
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
# Get script directory
SCRIPT_DIR="$(dirname "$0")"
# Create logs directory if it doesn't exist
mkdir -p "$SCRIPT_DIR/../logs"
# First, kill all processes on both port ranges
echo "🛑 Killing all processes on ports 3000-3010 and 8000-8010..."
for port in {3000..3010} {8000..8010}; do
lsof -ti :$port | xargs -r kill -9 2>/dev/null && echo " Killed process on port $port"
done
# Restart backend
echo "📦 Restarting backend..."
"$SCRIPT_DIR/restart-backend.sh"
# Wait for backend to stabilize
sleep 3
# Restart frontend
echo "🌐 Restarting frontend..."
"$SCRIPT_DIR/restart-frontend.sh"
echo ""
echo "🎉 Full stack restart complete!"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "📊 Backend: http://localhost:8000"
echo "📚 API Docs: http://localhost:8000/docs"
echo "🌐 Frontend: http://localhost:3002"
echo "🔧 Admin: http://localhost:3002/admin"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
echo "📋 Monitor logs:"
echo " Backend: tail -f logs/backend.log"
echo " Frontend: tail -f logs/frontend.log"