check_system_status.sh
1 #!/bin/bash 2 3 # Quick system status check for ECHO 4 5 # Colors 6 GREEN='\033[0;32m' 7 YELLOW='\033[1;33m' 8 RED='\033[0;31m' 9 BLUE='\033[0;34m' 10 NC='\033[0m' 11 12 echo -e "${BLUE}═══════════════════════════════════════════${NC}" 13 echo -e "${BLUE} ECHO System Status Check${NC}" 14 echo -e "${BLUE}═══════════════════════════════════════════${NC}" 15 echo "" 16 17 # PostgreSQL 18 echo -e "${BLUE}PostgreSQL:${NC}" 19 if pgrep -f postgres > /dev/null; then 20 echo -e " ${GREEN}✓ Running${NC}" 21 if psql -h localhost -U postgres -d echo_org_dev -c "SELECT COUNT(*) FROM messages;" 2>/dev/null | grep -q "row"; then 22 MSG_COUNT=$(psql -h localhost -U postgres -d echo_org_dev -t -c "SELECT COUNT(*) FROM messages;" 2>/dev/null | tr -d ' ') 23 DEC_COUNT=$(psql -h localhost -U postgres -d echo_org_dev -t -c "SELECT COUNT(*) FROM decisions;" 2>/dev/null | tr -d ' ') 24 echo -e " ${GREEN}✓ Database: echo_org_dev${NC}" 25 echo -e " ${BLUE} Messages: $MSG_COUNT${NC}" 26 echo -e " ${BLUE} Decisions: $DEC_COUNT${NC}" 27 else 28 echo -e " ${YELLOW}⚠ Database not accessible${NC}" 29 fi 30 else 31 echo -e " ${RED}✗ Not running${NC}" 32 fi 33 echo "" 34 35 # Redis 36 echo -e "${BLUE}Redis:${NC}" 37 if redis-cli ping &> /dev/null; then 38 echo -e " ${GREEN}✓ Running${NC}" 39 REDIS_KEYS=$(redis-cli DBSIZE 2>/dev/null | grep -o '[0-9]*') 40 echo -e " ${BLUE} Keys: $REDIS_KEYS${NC}" 41 else 42 echo -e " ${RED}✗ Not running${NC}" 43 fi 44 echo "" 45 46 # Ollama 47 echo -e "${BLUE}Ollama (LLM):${NC}" 48 if pgrep -f ollama > /dev/null; then 49 echo -e " ${GREEN}✓ Running${NC}" 50 MODEL_COUNT=$(ollama list 2>/dev/null | tail -n +2 | wc -l | tr -d ' ') 51 echo -e " ${BLUE} Models: $MODEL_COUNT${NC}" 52 else 53 echo -e " ${YELLOW}⚠ Not running (LLM features disabled)${NC}" 54 fi 55 echo "" 56 57 # Agent Executables 58 echo -e "${BLUE}Agent Executables:${NC}" 59 AGENTS=("ceo" "cto" "chro" "operations_head" "product_manager" "senior_architect" "uiux_engineer" "senior_developer" "test_lead") 60 BUILT=0 61 62 for agent in "${AGENTS[@]}"; do 63 if [ -f "apps/$agent/$agent" ]; then 64 BUILT=$((BUILT + 1)) 65 fi 66 done 67 68 if [ $BUILT -eq 9 ]; then 69 echo -e " ${GREEN}✓ All 9 agents built${NC}" 70 else 71 echo -e " ${YELLOW}⚠ $BUILT / 9 agents built${NC}" 72 fi 73 echo "" 74 75 # Summary 76 echo -e "${BLUE}═══════════════════════════════════════════${NC}" 77 POSTGRES_OK=$(pgrep -f postgres > /dev/null && echo "1" || echo "0") 78 REDIS_OK=$(redis-cli ping &> /dev/null && echo "1" || echo "0") 79 AGENTS_OK=$([ $BUILT -eq 9 ] && echo "1" || echo "0") 80 81 if [ "$POSTGRES_OK" = "1" ] && [ "$REDIS_OK" = "1" ] && [ "$AGENTS_OK" = "1" ]; then 82 echo -e "${GREEN}✓ System ready for Day 1 simulation${NC}" 83 echo "" 84 echo "Run: ./run_day1_all_agents.sh" 85 else 86 echo -e "${YELLOW}⚠ System not ready${NC}" 87 echo "" 88 [ "$POSTGRES_OK" = "0" ] && echo " - Start PostgreSQL" 89 [ "$REDIS_OK" = "0" ] && echo " - Start Redis (brew services start redis)" 90 [ "$AGENTS_OK" = "0" ] && echo " - Build agents (./setup.sh)" 91 fi 92 echo -e "${BLUE}═══════════════════════════════════════════${NC}"