check_systemd_service: also check if service is activating

This commit is contained in:
Cyberes 2024-03-28 20:57:40 -06:00
parent 87d752780a
commit 9b5d5e88a8
1 changed files with 4 additions and 1 deletions

View File

@ -48,7 +48,10 @@ fi
active=$(systemctl is-active "$UNIT")
substate=$(systemctl show "$UNIT" --property=SubState --value)
if [ "$active" != "active" ] || { [ "$substate" = "exited" ] && [ "$IS_TIMER" = false ]; }; then
if [ "$active" = "activating" ]; then
echo "WARNING - $UNIT is activating"
exit 1
elif [ "$active" != "active" ] || { [ "$substate" = "exited" ] && [ "$IS_TIMER" = false ]; }; then
echo "CRITICAL - $UNIT is not active"
exit 2
fi