From 0b9527ede03521a40f1174a5a6e40a943bf27e2d Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Fri, 23 Jan 2026 16:25:42 +0000 Subject: Fix Phase 4 scripts to run flawlessly without manual intervention Make scripts fully automatic with no manual intervention needed. Changes: - Add --no-pager to journalctl commands in validate-service.sh - Add service existence validation with helpful error messages - Capture and report journalctl stderr for better error visibility - Improve error handling without failing on empty logs The main issue was missing --no-pager in validate-service.sh which could cause scripts to hang when run non-interactively (e.g., via SSH). Tested locally - scripts run without hanging and produce correct output. --- docs/how-to/migration-scripts/validate-service.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'docs/how-to/migration-scripts/validate-service.sh') diff --git a/docs/how-to/migration-scripts/validate-service.sh b/docs/how-to/migration-scripts/validate-service.sh index 2525a3f..6988af3 100755 --- a/docs/how-to/migration-scripts/validate-service.sh +++ b/docs/how-to/migration-scripts/validate-service.sh @@ -108,9 +108,10 @@ validate_service_for_structured_logging() { fi # Check for structured log entries + # IMPORTANT: Use --no-pager to prevent hanging when run non-interactively (e.g., via SSH) local has_parse_fail has_purgatory - has_parse_fail=$(journalctl -u "$service_name" --since "7 days ago" 2>/dev/null | grep -c '\[PARSE_FAIL\]' || echo "0") - has_purgatory=$(journalctl -u "$service_name" --since "7 days ago" 2>/dev/null | grep -c '\[PURGATORY_EXPIRED\]' || echo "0") + has_parse_fail=$(journalctl --no-pager -u "$service_name" --since "7 days ago" 2>/dev/null | grep -c '\[PARSE_FAIL\]' || echo "0") + has_purgatory=$(journalctl --no-pager -u "$service_name" --since "7 days ago" 2>/dev/null | grep -c '\[PURGATORY_EXPIRED\]' || echo "0") # Strip any non-numeric characters (grep -c can have trailing whitespace) has_parse_fail="${has_parse_fail//[^0-9]/}" -- cgit v1.2.3