update exit codes
This commit is contained in:
parent
8ba15ef4f0
commit
d32c56685f
|
@ -19,7 +19,7 @@ help()
|
|||
echo " -h Print this help."
|
||||
echo " -z <zone> Zone to get."
|
||||
echo
|
||||
echo " Echoes 'true' if zone exists, 'false' if zone does not exist, 'error' with exit code 1 on error."
|
||||
echo " Echoes 'true' if zone exists with exit code 0, 'false' if zone does not exist with exit code 1, 'error' with exit code 2 on error."
|
||||
}
|
||||
|
||||
pdns:getoptions "$@"
|
||||
|
@ -36,11 +36,13 @@ zone_status=$(/usr/bin/curl --silent --output /dev/null --write-out "%{http_code
|
|||
if [[ $zone_status = 200 ]]; then
|
||||
# zone exists
|
||||
echo true
|
||||
exit 0
|
||||
elif [[ $zone_status = 404 ]]; then
|
||||
# zone does not exist
|
||||
echo false
|
||||
exit 1
|
||||
else
|
||||
# error, unexpected response code
|
||||
echo error
|
||||
exit 1
|
||||
exit 2
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue
Block a user