Return a sensible exit code

This commit is contained in:
Chris Lamb 2018-01-13 17:08:24 +01:00 committed by Sylvestre Ledru
parent 7f92717a2c
commit b1d6d79729
1 changed files with 7 additions and 0 deletions

View File

@ -94,6 +94,8 @@ nrpe_critical=0
nrpe_unknown=0 nrpe_unknown=0
nrpe_vuln="" nrpe_vuln=""
ret=0
__echo() __echo()
{ {
opt="$1" opt="$1"
@ -365,6 +367,9 @@ pvulnstatus()
VULN) pstatus red 'VULNERABLE' "$@";; VULN) pstatus red 'VULNERABLE' "$@";;
OK) pstatus green 'NOT VULNERABLE' "$@";; OK) pstatus green 'NOT VULNERABLE' "$@";;
esac esac
case "$vulnstatus" in
UNK|VULN) ret=1
esac
} }
@ -980,3 +985,5 @@ fi
if [ "$opt_batch" = 1 -a "$opt_batch_format" = "json" ]; then if [ "$opt_batch" = 1 -a "$opt_batch_format" = "json" ]; then
_echo 0 ${json_output%?}] _echo 0 ${json_output%?}]
fi fi
exit $ret