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:
@@ -225,8 +225,16 @@ echo " kill $BACKEND_PID $FRONTEND_PID"
|
|||||||
echo ""
|
echo ""
|
||||||
log_success "Servers are running!"
|
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
|
trap "log_info 'Received interrupt signal'; kill $BACKEND_PID $FRONTEND_PID 2>/dev/null || true; exit 0" SIGINT SIGTERM
|
||||||
|
|
||||||
# Wait for both processes
|
# Monitor processes - restart if they crash
|
||||||
wait
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user