diff --git a/check_apt_critical.sh b/check_apt_critical.sh index 26dd8aa..f44b75c 100755 --- a/check_apt_critical.sh +++ b/check_apt_critical.sh @@ -41,7 +41,8 @@ fi if [[ $CRIT_LEVEL -gt 0 ]] || [[ $WARN_LEVEL -gt 0 ]]; then # Only use the levels if the user has set one of them. - if [[ $NUM_CRIT_UPDATES -ge $CRIT_LEVEL ]]; then + if [[ $CRIT_LEVEL -gt 0 ]] && [[ $NUM_CRIT_UPDATES -ge $CRIT_LEVEL ]]; then + # If the crit level is 0, that means the user has only set the --warn flag. We'll just ignore the crit level since that's what they did. echo "CRITICAL - $NUM_CRIT_UPDATES critical updates available. | critical_updates=$NUM_CRIT_UPDATES" exit 2 elif [[ $NUM_CRIT_UPDATES -ge $WARN_LEVEL ]]; then