From 08fdfc3a2e608acdcfe1af3a62805cacb2e27763 Mon Sep 17 00:00:00 2001 From: BeauTroll <-> Date: Thu, 18 Dec 2025 03:12:37 +0100 Subject: [PATCH] fix: prevent spurious N/A output in health check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed issue where "N/A" was being printed directly to stdout instead of being captured in variables when du commands partially failed. Changed from: DATA_SIZE=$(du -sh ./data 2>/dev/null | cut -f1 || echo "N/A") To: DATA_SIZE=$(du -sh ./data 2>/dev/null | cut -f1) if [ -z "$DATA_SIZE" ]; then DATA_SIZE="N/A" fi This prevents spurious "N/A" lines appearing in the health check output. Fixed for: - DATA_SIZE (data directory size) - DB_SIZE (database directory size) - LOGS_SIZE (logs directory size) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- scripts/check-health.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/scripts/check-health.sh b/scripts/check-health.sh index 0837f1d..258381b 100755 --- a/scripts/check-health.sh +++ b/scripts/check-health.sh @@ -176,12 +176,18 @@ fi # Vérifier la taille des données if [ -d ./data ]; then - DATA_SIZE=$(du -sh ./data 2>/dev/null | cut -f1 || echo "N/A") + DATA_SIZE=$(du -sh ./data 2>/dev/null | cut -f1) + if [ -z "$DATA_SIZE" ]; then + DATA_SIZE="N/A" + fi check_ok "Taille des données: $DATA_SIZE" fi if [ -d ./db ]; then - DB_SIZE=$(du -sh ./db 2>/dev/null | cut -f1 || echo "N/A") + DB_SIZE=$(du -sh ./db 2>/dev/null | cut -f1) + if [ -z "$DB_SIZE" ]; then + DB_SIZE="N/A" + fi check_ok "Taille de la base: $DB_SIZE" fi @@ -233,7 +239,10 @@ if [ -d ./logs ]; then LOG_COUNT=$(find ./logs -type f 2>/dev/null | wc -l) check_ok "$LOG_COUNT fichier(s) de log" - LOGS_SIZE=$(du -sh ./logs 2>/dev/null | cut -f1 || echo "N/A") + LOGS_SIZE=$(du -sh ./logs 2>/dev/null | cut -f1) + if [ -z "$LOGS_SIZE" ]; then + LOGS_SIZE="N/A" + fi check_ok "Taille des logs: $LOGS_SIZE" else check_warn "Dossier de logs introuvable"