From 46fcb1abce49b1494cec31e273cb5f74d22e7b85 Mon Sep 17 00:00:00 2001 From: Tobias Wiese Date: Sat, 28 Aug 2021 18:06:09 +0200 Subject: list failed units In the case, that there is at least one failed unit, list them. Signed-off-by: Tobias Wiese --- check_systemd | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'check_systemd') diff --git a/check_systemd b/check_systemd index c71682b..9912c48 100755 --- a/check_systemd +++ b/check_systemd @@ -23,4 +23,10 @@ fi printf "SYSTEM %s: %d units failed.\n" "$SYSTEM_STATE" "$FAILED_UNITS" -[ "0" = "$FAILED_UNITS" ] || exit 2 +if [ "0" = "$FAILED_UNITS" ]; then + exit 0 +else + printf "\nFailed units:\n" + systemctl list-units --failed --no-legend | awk '{print "- " $1;}' + exit 2 +fi -- cgit v1.2.3