add exit codes
This commit is contained in:
parent
6358759970
commit
b7cd35384c
|
@ -30,7 +30,7 @@ pdns:getoptions "$@"
|
|||
# check for zone
|
||||
if [[ -z $zone ]]; then
|
||||
echo "zone is required"
|
||||
exit
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# first query to see if zone already exists
|
||||
|
@ -38,6 +38,7 @@ zone_status=$(/usr/bin/curl --silent --output /dev/null --write-out "%{http_code
|
|||
|
||||
if [[ $zone_status = 200 ]]; then
|
||||
echo Zone $zone already exists.
|
||||
exit 1
|
||||
elif [[ $zone_status = 404 ]]; then
|
||||
|
||||
# zone does not exist, create new zone now
|
||||
|
@ -159,10 +160,13 @@ elif [[ $zone_status = 404 ]]; then
|
|||
|
||||
if [[ $zone_status = 201 ]]; then
|
||||
echo Success. Zone $zone created.
|
||||
exit 0
|
||||
else
|
||||
echo Error. http response adding zone $zone was: $zone_status
|
||||
exit 1
|
||||
fi
|
||||
|
||||
else
|
||||
echo Unexpected http response checking for Zone $zone: $zone_status
|
||||
exit 1
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue
Block a user