summaryrefslogtreecommitdiff
path: root/bin
diff options
Diffstat (limited to 'bin')
-rwxr-xr-xbin/failed_service_check.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/bin/failed_service_check.sh b/bin/failed_service_check.sh
new file mode 100755
index 0000000..172f20a
--- /dev/null
+++ b/bin/failed_service_check.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+COUNT=$(systemctl --system --no-ask-password --no-pager --no-legend list-units --state=failed | wc -l)
+printf "Found %s failed units\n" "$COUNT"
+if [ "$COUNT" -eq 0 ]; then
+ exit 0
+else
+ printf "\nFailed units:\n"
+ systemctl --system --no-ask-password --no-pager list-units --state=failed
+fi
+exit 1