@@ -216,6 +216,7 @@ info() { echo -e "${BLUE}[INFO]${NC} $1"; }
216216success () { echo -e " ${GREEN} [SUCCESS]${NC} $1 " ; }
217217warning () { echo -e " ${YELLOW} [WARNING]${NC} $1 " ; }
218218error () { echo -e " ${RED} [ERROR]${NC} $1 " ; }
219+ notfound () { echo -e " ${YELLOW} [NOTFOUND]${NC} $1 " ; }
219220
220221# Check if a service is running (system-wide, slot-unaware)
221222is_running () {
@@ -724,7 +725,7 @@ show_slot_services_status() {
724725 elif port_listening " $minio_port " ; then
725726 success " MinIO: Running (API: $minio_port , Console: $minio_console_port )"
726727 else
727- error " MinIO: Stopped"
728+ notfound " MinIO: Stopped"
728729 fi
729730
730731 # happy-server (slot-specific)
@@ -737,7 +738,7 @@ show_slot_services_status() {
737738 elif port_listening " $server_port " ; then
738739 success " happy-server: Running (port $server_port )"
739740 else
740- error " happy-server: Stopped"
741+ notfound " happy-server: Stopped"
741742 fi
742743
743744 # Webapp (slot-specific)
@@ -750,7 +751,7 @@ show_slot_services_status() {
750751 elif port_listening " $webapp_port " ; then
751752 success " Webapp: Running (port $webapp_port )"
752753 else
753- error " Webapp: Stopped"
754+ notfound " Webapp: Stopped"
754755 fi
755756}
756757
@@ -783,13 +784,13 @@ show_status() {
783784 if port_listening " $POSTGRES_PORT " ; then
784785 success " PostgreSQL: Running (port $POSTGRES_PORT , database: $DATABASE_NAME )"
785786 else
786- error " PostgreSQL: Stopped"
787+ notfound " PostgreSQL: Stopped"
787788 fi
788789
789790 if port_listening " $REDIS_PORT " ; then
790791 success " Redis: Running (port $REDIS_PORT , shared)"
791792 else
792- error " Redis: Stopped"
793+ notfound " Redis: Stopped"
793794 fi
794795
795796 # Slot-specific services
@@ -809,13 +810,13 @@ show_all_slots_status() {
809810 if port_listening " $POSTGRES_PORT " ; then
810811 success " PostgreSQL: Running (port $POSTGRES_PORT )"
811812 else
812- error " PostgreSQL: Stopped"
813+ notfound " PostgreSQL: Stopped"
813814 fi
814815
815816 if port_listening " $REDIS_PORT " ; then
816817 success " Redis: Running (port $REDIS_PORT )"
817818 else
818- error " Redis: Stopped"
819+ notfound " Redis: Stopped"
819820 fi
820821 echo " "
821822
@@ -1031,6 +1032,24 @@ case "${1:-}" in
10311032 show_urls
10321033 ;;
10331034
1035+ monitor)
1036+ # Monitor mode: show status periodically, handle signals gracefully
1037+ info " Monitoring services (Ctrl-C to stop)..."
1038+ echo " "
1039+
1040+ # Trap signals for graceful exit
1041+ trap ' echo ""; info "Monitor stopped"; exit 0' SIGINT SIGTERM
1042+
1043+ while true ; do
1044+ echo " "
1045+ echo " === Happy Monitor ($( date ' +%H:%M:%S' ) ) - Ctrl-C to stop ==="
1046+ echo " "
1047+ show_status
1048+ sleep 60 &
1049+ wait $! # Wait on sleep so signals can interrupt it
1050+ done
1051+ ;;
1052+
10341053 env)
10351054 print_env
10361055 ;;
@@ -1068,6 +1087,7 @@ case "${1:-}" in
10681087 echo " status Show status of all services"
10691088 echo " status --all-slots Show status for all active slots"
10701089 echo " logs <service> Tail logs for a service (server, webapp, minio, postgres)"
1090+ echo " monitor Show status every 60 seconds (handles Ctrl-C gracefully)"
10711091 echo " env Print environment variables for this slot (can be sourced)"
10721092 echo " cli [args] Run happy CLI with local server configuration"
10731093 echo " test Test server and CLI connectivity"
0 commit comments