FIX: Add error handling to standalone domain discovery and remove color codes

FIXES:
1. Added error handling (|| true) to get_standalone_user_domains()
   - Prevents script crash with set -eo pipefail on standalone servers
   - Function now always succeeds even if find fails
   - Prevents tmux session crashes

2. Removed all ANSI color codes from launcher output
   - Color codes were showing as raw \033[0;36m instead of rendering
   - Simplified output without color variables
   - Better compatibility with different terminal types
   - Cleaner output on all systems

Changes:
- lib/user-manager.sh: Added || true to prevent failures
- launcher.sh: Removed , , , etc. from output
  - show_banner(): Removed color codes
  - show_system_overview(): Removed color codes
  - show_main_menu(): Removed color codes

Impact:
- Standalone servers no longer crash when building reference database
- Output is clean and readable on all terminal types
- Detection/database building now completes successfully

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
Developer
2026-03-19 22:00:22 -04:00
parent 7bf42ee2f7
commit a30fc46f07
2 changed files with 31 additions and 31 deletions
+30 -30
View File
@@ -37,12 +37,12 @@ NC='\033[0m'
# Banner # Banner
show_banner() { show_banner() {
clear clear
echo -e "${YELLOW}═══════════════════════════════════════════════════════════════${NC}" echo "═══════════════════════════════════════════════════════════════"
echo -e "${YELLOW} ⚠️ Server Management Toolkit v${SUITE_VERSION}${NC}" echo " ⚠️ Server Management Toolkit v${SUITE_VERSION}"
echo -e "${YELLOW} 🧪 BETA/DEV VERSION - Testing & Development${NC}" echo " 🧪 BETA/DEV VERSION - Testing & Development"
echo -e "${YELLOW} Complete cPanel/Linux Server Administration Suite${NC}" echo " Complete cPanel/Linux Server Administration Suite"
echo -e "${YELLOW}═══════════════════════════════════════════════════════════════${NC}" echo "═══════════════════════════════════════════════════════════════"
echo -e "${MAGENTA} ⚠️ This is a SEPARATE INSTANCE from production${NC}" echo " ⚠️ This is a SEPARATE INSTANCE from production"
echo "" echo ""
} }
@@ -91,46 +91,46 @@ show_system_overview() {
fi fi
echo "" echo ""
echo -e "${BOLD}🖥️ System Information:${NC}" echo "🖥️ System Information:"
# Control Panel # Control Panel
if [ "$SYS_CONTROL_PANEL" != "none" ]; then if [ "$SYS_CONTROL_PANEL" != "none" ]; then
echo -n " Control Panel: ${CYAN}${SYS_CONTROL_PANEL^^}${NC}" echo -n " Control Panel: ${SYS_CONTROL_PANEL^^}"
[ -n "$SYS_CONTROL_PANEL_VERSION" ] && echo -n " v${SYS_CONTROL_PANEL_VERSION}" || echo -n " (version unknown)" [ -n "$SYS_CONTROL_PANEL_VERSION" ] && echo -n " v${SYS_CONTROL_PANEL_VERSION}" || echo -n " (version unknown)"
echo "" echo ""
else else
echo " Control Panel: ${CYAN}Standalone${NC} (no control panel)" echo " Control Panel: Standalone (no control panel)"
fi fi
# OS # OS
echo " OS: ${CYAN}${SYS_OS_TYPE^^}${NC} ${SYS_OS_VERSION}" echo " OS: ${SYS_OS_TYPE^^} ${SYS_OS_VERSION}"
[ "${SYS_CLOUDLINUX:-}" = "yes" ] && echo -e " ${CYAN}${NC} CloudLinux detected" [ "${SYS_CLOUDLINUX:-}" = "yes" ] && echo " ➜ CloudLinux detected"
# Web Server # Web Server
echo -n " Web Server: ${CYAN}${SYS_WEB_SERVER^^}${NC}" echo -n " Web Server: ${SYS_WEB_SERVER^^}"
[ -n "$SYS_WEB_SERVER_VERSION" ] && echo " v${SYS_WEB_SERVER_VERSION}" || echo "" [ -n "$SYS_WEB_SERVER_VERSION" ] && echo " v${SYS_WEB_SERVER_VERSION}" || echo ""
# Database # Database
if [ "$SYS_DB_TYPE" != "none" ]; then if [ "$SYS_DB_TYPE" != "none" ]; then
echo -n " Database: ${CYAN}${SYS_DB_TYPE^^}${NC}" echo -n " Database: ${SYS_DB_TYPE^^}"
[ -n "$SYS_DB_VERSION" ] && echo " v${SYS_DB_VERSION}" || echo "" [ -n "$SYS_DB_VERSION" ] && echo " v${SYS_DB_VERSION}" || echo ""
fi fi
# PHP Versions # PHP Versions
if [ ${#SYS_PHP_VERSIONS[@]} -gt 0 ]; then if [ ${#SYS_PHP_VERSIONS[@]} -gt 0 ]; then
echo -n " PHP Versions: ${CYAN}" echo -n " PHP Versions: "
printf '%s, ' "${SYS_PHP_VERSIONS[@]}" | sed 's/, $//' printf '%s, ' "${SYS_PHP_VERSIONS[@]}" | sed 's/, $//'
echo "${NC}" echo ""
fi fi
# Firewall # Firewall
if [ "$SYS_FIREWALL" != "none" ]; then if [ "$SYS_FIREWALL" != "none" ]; then
echo -n " Firewall: ${CYAN}${SYS_FIREWALL^^}${NC}" echo -n " Firewall: ${SYS_FIREWALL^^}"
[ "$SYS_FIREWALL_ACTIVE" = "yes" ] && echo " (${GREEN}active${NC})" || echo " (${YELLOW}inactive${NC})" [ "$SYS_FIREWALL_ACTIVE" = "yes" ] && echo " (active)" || echo " (inactive)"
fi fi
# Cloudflare # Cloudflare
[ "$SYS_CLOUDFLARE_ACTIVE" = "yes" ] && echo " Cloudflare: ${YELLOW}Detected${NC}" [ "$SYS_CLOUDFLARE_ACTIVE" = "yes" ] && echo " Cloudflare: Detected"
echo "" echo ""
} }
@@ -145,25 +145,25 @@ show_main_menu() {
# Show quick system overview if detection is complete # Show quick system overview if detection is complete
[ -n "${SYS_DETECTION_COMPLETE:-}" ] && show_system_overview [ -n "${SYS_DETECTION_COMPLETE:-}" ] && show_system_overview
echo -e "${BOLD}Quick Diagnostics:${NC}" echo "Quick Diagnostics:"
echo "" echo ""
echo -e " ${MAGENTA}1)${NC} 🏥 System Health Check - Full server diagnostics" echo " 1) 🏥 System Health Check - Full server diagnostics"
echo "" echo ""
echo -e "${BOLD}Main Categories:${NC}" echo "Main Categories:"
echo "" echo ""
echo -e " ${GREEN}2)${NC} 🛡️ Security & Monitoring" echo " 2) 🛡️ Security & Monitoring"
echo -e " ${BLUE}3)${NC} 🌐 Website Diagnostics" echo " 3) 🌐 Website Diagnostics"
echo -e " ${MAGENTA}4)${NC} 🔧 Performance & Maintenance" echo " 4) 🔧 Performance & Maintenance"
echo -e " ${YELLOW}5)${NC} 💾 Backup & Recovery" echo " 5) 💾 Backup & Recovery"
echo -e " ${CYAN}6)${NC} 📧 Email Troubleshooting" echo " 6) 📧 Email Troubleshooting"
echo "" echo ""
echo -e "${BOLD}System:${NC}" echo "System:"
echo "" echo ""
echo -e " ${YELLOW}7)${NC} 🗑️ Cleanup Toolkit Data - Clear cached data" echo " 7) 🗑️ Cleanup Toolkit Data - Clear cached data"
echo "" echo ""
echo -e " ${RED}0)${NC} Exit" echo " 0) Exit"
echo "" echo ""
echo -e "${CYAN}═══════════════════════════════════════════════════════════════${NC}" echo "═══════════════════════════════════════════════════════════════"
echo -n "Select option: " echo -n "Select option: "
} }
+1 -1
View File
@@ -331,7 +331,7 @@ get_standalone_user_domains() {
find "$home_dir" -maxdepth 2 \( -name "public_html" -o -name "html" \) -type d 2>/dev/null | \ find "$home_dir" -maxdepth 2 \( -name "public_html" -o -name "html" \) -type d 2>/dev/null | \
sed "s|${home_dir}/||; s|/public_html$||; s|/html$||" | \ sed "s|${home_dir}/||; s|/public_html$||; s|/html$||" | \
grep -v "^$" | sort -u grep -v "^$" | sort -u || true
} }
############################################################################# #############################################################################