Fix a bug where oneshot services that weren't running got weird status text

This commit is contained in:
Salt 2021-08-18 19:03:14 -05:00
parent 2330f1551e
commit f877fac512

View File

@ -37,12 +37,13 @@ else
;; ;;
3) 3)
# In this case, the unit is not running. Whether this is an issue depends on the type of service # In this case, the unit is not running. Whether this is an issue depends on the type of service
if systemctl cat backup | grep -ie '^Type=' | grep -ie 'oneshot'; then if systemctl cat backup | grep -ie '^Type=' | grep -ie 'oneshot' > /dev/null 2>&1; then
echo "UNIT OK: $service is not running" echo "UNIT OK: $service is not running"
exit 0
else else
echo "UNIT CRITICAL: $service is not running" echo "UNIT CRITICAL: $service is not running"
exit 4
fi fi
exit 0
;; ;;
4) 4)
echo "UNIT CRITICAL: $service is not present on this machine" echo "UNIT CRITICAL: $service is not present on this machine"