From 66464cb148f62a13186b2c34bb15c3a33e59de76 Mon Sep 17 00:00:00 2001 From: Daniel Bedeleanu Date: Wed, 22 Apr 2026 18:34:18 +0300 Subject: [PATCH] fix(6): fix process monitoring - keep servers running indefinitely - Replace wait with infinite monitoring loop - Detect and warn if processes die instead of killing them - Allows independent process failures without terminating script - Trap still catches Ctrl-C to graceful shutdown --- start_server.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) 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