From d32c56685ffafd021667292f78e00c4d379594ca Mon Sep 17 00:00:00 2001 From: Matthew Saunders Brown Date: Tue, 8 Aug 2023 13:22:11 -0700 Subject: [PATCH] update exit codes --- bin/pdns-zone-ext.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/pdns-zone-ext.sh b/bin/pdns-zone-ext.sh index 93b26f1..955967d 100755 --- a/bin/pdns-zone-ext.sh +++ b/bin/pdns-zone-ext.sh @@ -19,7 +19,7 @@ help() echo " -h Print this help." echo " -z 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