diff --git a/start_server.sh b/start_server.sh index 78639092..1df72106 100755 --- a/start_server.sh +++ b/start_server.sh @@ -225,8 +225,16 @@ echo " kill $BACKEND_PID $FRONTEND_PID" echo "" log_success "Servers are running!" -# Keep script running and handle signals +# Keep script running indefinitely and handle signals trap "log_info 'Received interrupt signal'; kill $BACKEND_PID $FRONTEND_PID 2>/dev/null || true; exit 0" SIGINT SIGTERM -# Wait for both processes -wait +# Monitor processes - restart if they crash +while true; do + if ! kill -0 $BACKEND_PID 2>/dev/null; then + log_warn "Backend process died (PID $BACKEND_PID), monitoring stopped" + fi + if ! kill -0 $FRONTEND_PID 2>/dev/null; then + log_warn "Frontend process died (PID $FRONTEND_PID), monitoring stopped" + fi + sleep 5 +done