From afd1587837b080c0dff0d7664ec9101682230f66 Mon Sep 17 00:00:00 2001 From: zaphod-black Date: Sat, 1 Nov 2025 18:43:01 -0500 Subject: [PATCH] Fix logs not closing after backup completion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Changed process management in backup monitoring - Monitor process now runs in background and kills journalctl when service completes - journalctl runs in foreground (easier to kill properly) - Fixes issue where logs would stay open showing blank screen - Applied to both "Run backup now" menu option and post-install backup 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- pbs-client-installer.sh | 49 +++++++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/pbs-client-installer.sh b/pbs-client-installer.sh index 59b0e47..d96db2c 100755 --- a/pbs-client-installer.sh +++ b/pbs-client-installer.sh @@ -813,19 +813,23 @@ run_backup_now() { echo "╚════════════════════════════════════════════════════════════╝" echo - # Follow logs to show progress - timeout 3600 journalctl -fu pbs-backup.service & - JOURNAL_PID=$! + # Monitor backup in background and kill journalctl when done + ( + while systemctl is-active --quiet pbs-backup.service; do + sleep 2 + done + # Service finished, kill the journal follow + pkill -P $$ journalctl 2>/dev/null + ) & + MONITOR_PID=$! - # Wait for the service to complete or fail - while systemctl is-active --quiet pbs-backup.service; do - sleep 2 - done + # Follow logs in foreground (will be killed by monitor when backup completes) + journalctl -fu pbs-backup.service 2>/dev/null || true - # Kill the journal follow - kill $JOURNAL_PID 2>/dev/null || true - wait $JOURNAL_PID 2>/dev/null || true + # Wait for monitor to finish + wait $MONITOR_PID 2>/dev/null + # Clear any leftover output echo echo "════════════════════════════════════════════════════════════" @@ -963,20 +967,23 @@ main() { echo "╚════════════════════════════════════════════════════════════╝" echo - # Follow logs to show progress - # Using timeout to automatically stop after backup completes - timeout 3600 journalctl -fu pbs-backup.service & - JOURNAL_PID=$! + # Monitor backup in background and kill journalctl when done + ( + while systemctl is-active --quiet pbs-backup.service; do + sleep 2 + done + # Service finished, kill the journal follow + pkill -P $$ journalctl 2>/dev/null + ) & + MONITOR_PID=$! - # Wait for the service to complete or fail - while systemctl is-active --quiet pbs-backup.service; do - sleep 2 - done + # Follow logs in foreground (will be killed by monitor when backup completes) + journalctl -fu pbs-backup.service 2>/dev/null || true - # Kill the journal follow - kill $JOURNAL_PID 2>/dev/null || true - wait $JOURNAL_PID 2>/dev/null || true + # Wait for monitor to finish + wait $MONITOR_PID 2>/dev/null + # Clear any leftover output echo echo "════════════════════════════════════════════════════════════"