[systemd-devel] Q: Relying on exit code of journalctl -g ....

Ulrich Windl Ulrich.Windl at rz.uni-regensburg.de
Wed Mar 23 09:32:26 UTC 2022


Hi!

It's not documented, but "journalctl -g ..." seems to exit with success when the pattern was found, and with 1 when it was not.
Can I rely on that?

The other thing is when grepping across reboots, the "-- Reboot --" is always output, even if it does not match the pattern. Is that a bug or a feature?

(systemd-246.16 of SLES15 SP3)

Actually I had some "quiet grep" in mind that only sets the exit code depending whether some message was found or not.

Regards,
Ulrich





More information about the systemd-devel mailing list