Fix logs not closing after backup completion
- 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 <noreply@anthropic.com>
This commit is contained in:
parent
93debf1e21
commit
afd1587837
1 changed files with 28 additions and 21 deletions
|
|
@ -813,19 +813,23 @@ run_backup_now() {
|
||||||
echo "╚════════════════════════════════════════════════════════════╝"
|
echo "╚════════════════════════════════════════════════════════════╝"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
# Follow logs to show progress
|
# Monitor backup in background and kill journalctl when done
|
||||||
timeout 3600 journalctl -fu pbs-backup.service &
|
(
|
||||||
JOURNAL_PID=$!
|
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
|
# Follow logs in foreground (will be killed by monitor when backup completes)
|
||||||
while systemctl is-active --quiet pbs-backup.service; do
|
journalctl -fu pbs-backup.service 2>/dev/null || true
|
||||||
sleep 2
|
|
||||||
done
|
|
||||||
|
|
||||||
# Kill the journal follow
|
# Wait for monitor to finish
|
||||||
kill $JOURNAL_PID 2>/dev/null || true
|
wait $MONITOR_PID 2>/dev/null
|
||||||
wait $JOURNAL_PID 2>/dev/null || true
|
|
||||||
|
|
||||||
|
# Clear any leftover output
|
||||||
echo
|
echo
|
||||||
echo "════════════════════════════════════════════════════════════"
|
echo "════════════════════════════════════════════════════════════"
|
||||||
|
|
||||||
|
|
@ -963,20 +967,23 @@ main() {
|
||||||
echo "╚════════════════════════════════════════════════════════════╝"
|
echo "╚════════════════════════════════════════════════════════════╝"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
# Follow logs to show progress
|
# Monitor backup in background and kill journalctl when done
|
||||||
# Using timeout to automatically stop after backup completes
|
(
|
||||||
timeout 3600 journalctl -fu pbs-backup.service &
|
while systemctl is-active --quiet pbs-backup.service; do
|
||||||
JOURNAL_PID=$!
|
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
|
# Follow logs in foreground (will be killed by monitor when backup completes)
|
||||||
while systemctl is-active --quiet pbs-backup.service; do
|
journalctl -fu pbs-backup.service 2>/dev/null || true
|
||||||
sleep 2
|
|
||||||
done
|
|
||||||
|
|
||||||
# Kill the journal follow
|
# Wait for monitor to finish
|
||||||
kill $JOURNAL_PID 2>/dev/null || true
|
wait $MONITOR_PID 2>/dev/null
|
||||||
wait $JOURNAL_PID 2>/dev/null || true
|
|
||||||
|
|
||||||
|
# Clear any leftover output
|
||||||
echo
|
echo
|
||||||
echo "════════════════════════════════════════════════════════════"
|
echo "════════════════════════════════════════════════════════════"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue