diff options
| author | Tobias Wiese <tobias@tobiaswiese.com> | 2021-08-28 18:06:09 +0200 |
|---|---|---|
| committer | Tobias Wiese <tobias@tobiaswiese.com> | 2021-08-28 18:06:09 +0200 |
| commit | 46fcb1abce49b1494cec31e273cb5f74d22e7b85 (patch) | |
| tree | 10bfedc7b8052e12032d26e2c4ec48cf5c121530 | |
| parent | ff5d647e7a398dd09513347628d7a2909639b2f3 (diff) | |
list failed units1.1.0
In the case, that there is at least one failed unit, list them.
Signed-off-by: Tobias Wiese <tobias@tobiaswiese.com>
| -rwxr-xr-x | check_systemd | 8 |
1 files changed, 7 insertions, 1 deletions
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 |
