upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/docs/how-to/migration-scripts/validate-service.sh
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2026-01-23 16:25:42 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2026-01-27 20:38:05 +0000
commit0b9527ede03521a40f1174a5a6e40a943bf27e2d (patch)
tree851d0b8a4dfb0d73f3964a473548cdb4c526a59c /docs/how-to/migration-scripts/validate-service.sh
parent2b21b807bdf6c0bab548ffceb5c41eee0902890c (diff)
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.
Diffstat (limited to 'docs/how-to/migration-scripts/validate-service.sh')
-rwxr-xr-xdocs/how-to/migration-scripts/validate-service.sh5
1 files changed, 3 insertions, 2 deletions
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() {
108 fi 108 fi
109 109
110 # Check for structured log entries 110 # Check for structured log entries
111 # IMPORTANT: Use --no-pager to prevent hanging when run non-interactively (e.g., via SSH)
111 local has_parse_fail has_purgatory 112 local has_parse_fail has_purgatory
112 has_parse_fail=$(journalctl -u "$service_name" --since "7 days ago" 2>/dev/null | grep -c '\[PARSE_FAIL\]' || echo "0") 113 has_parse_fail=$(journalctl --no-pager -u "$service_name" --since "7 days ago" 2>/dev/null | grep -c '\[PARSE_FAIL\]' || echo "0")
113 has_purgatory=$(journalctl -u "$service_name" --since "7 days ago" 2>/dev/null | grep -c '\[PURGATORY_EXPIRED\]' || echo "0") 114 has_purgatory=$(journalctl --no-pager -u "$service_name" --since "7 days ago" 2>/dev/null | grep -c '\[PURGATORY_EXPIRED\]' || echo "0")
114 115
115 # Strip any non-numeric characters (grep -c can have trailing whitespace) 116 # Strip any non-numeric characters (grep -c can have trailing whitespace)
116 has_parse_fail="${has_parse_fail//[^0-9]/}" 117 has_parse_fail="${has_parse_fail//[^0-9]/}"