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
This commit is contained in:
2026-04-22 18:34:18 +03:00
parent 7041a6dc88
commit 66464cb148

View File

@@ -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