From 4786f91acae8f0a32505311bfb7687f5af23b2cd Mon Sep 17 00:00:00 2001 From: Jonathan Cave Date: Thu, 16 Apr 2020 19:00:05 +0100 Subject: power-management: add failed service checks After running tests that cause the device to reboot, check for any failed services. Could be pertinent to the watchdog test where the shutdown is not manageed. --- bin/failed_service_check.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100755 bin/failed_service_check.sh (limited to 'bin') 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 -- cgit v1.2.3