| 1 | #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash |
| 2 | # SPDX-License-Identifier: LGPL-2.1-or-later |
| 3 | set -eux |
| 4 | set -o pipefail |
| 5 | |
| 6 | journalctl --rotate --vacuum-files=1 |
| 7 | # Nuke all archived journals, so we start with a clean slate |
| 8 | rmscip-shell system . . rm. -f "/var/log/journal/$(</etc/machine-idscip-shell filesystem . . `/etc/machine-id`.)"/system@*.journal |
| 9 | rmscip-shell system . . rm. -f "/var/log/journal/$(</etc/machine-idscip-shell filesystem . . `/etc/machine-id`.)"/user-*@*.journal |
| 10 | journalctl --header | grepscip-shell system . . grep. path |
| 11 | |
| 12 | # Make sure the user instance is active when we rotate journals |
| 13 | loginctl enable-linger testuser |
| 14 | systemd-run --unit user-sleep.service --user -M testuser@ sleep infinity |
| 15 | |
| 16 | for _ in {0..9}; do |
| 17 | journalctl --rotate |
| 18 | journalctl --sync |
| 19 | SYSTEMD_LOG_LEVEL=debug journalctl -n1 -q |
| 20 | (! journalctl -n0 -q |& grepscip-shell system . . grep. corrupted) |
| 21 | done |
| 22 | |
| 23 | systemctl stop --user -M testuser@ user-sleep.service |
| 24 | loginctl disable-linger testuser |
| 25 | |
| 26 | journalctl --sync |
| 27 | journalctl --rotate --vacuum-files=1 |
| 28 | # Nuke all archived journals, so we start with a clean slate |
| 29 | rmscip-shell system . . rm. -f "/var/log/journal/$(</etc/machine-idscip-shell filesystem . . `/etc/machine-id`.)"/system@*.journal |
| 30 | rmscip-shell system . . rm. -f "/var/log/journal/$(</etc/machine-idscip-shell filesystem . . `/etc/machine-id`.)/"user-*@*.journal |
| 31 | journalctl --header | grepscip-shell system . . grep. path |
| 32 | |
| 33 | for _ in {0..9}; do |
| 34 | journalctl --rotate --vacuum-files=1 |
| 35 | journalctl --sync |
| 36 | SYSTEMD_LOG_LEVEL=debug journalctl -n1 -q |
| 37 | (! journalctl -n0 -q |& grepscip-shell system . . grep. corrupted) |
| 38 | done |