summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xupdate.sh21
1 files changed, 18 insertions, 3 deletions
diff --git a/update.sh b/update.sh
index 59e57ba..977b96a 100755
--- a/update.sh
+++ b/update.sh
@@ -47,10 +47,25 @@ if [ "$config_ip" != "$actual_ip" ]; then
]
}
EOF
- aws route53 change-resource-record-sets \
+ res=$(aws route53 change-resource-record-sets \
--hosted-zone-id $HOSTED_ZONE_ID \
- --change-batch "file://$RECORD_CHANGE_JSON"
-
+ --change-batch "file://$RECORD_CHANGE_JSON")
+ status=$(jq -r '.ChangeInfo.Status' $res)
+
+ if [ "$status" == "PENDING" ]; then
+ echo "Change submitted. Overall is Pending! (This is expected)"
+ exit 0
+ else
+
+ if [ "$status" == "SUCCESS" ]; then
+ echo "Change successful"
+ exit 0
+ else
+ echo "Non-successful status code: $status"
+ exit 1
+ fi
+ fi
+
else
echo "$DOMAIN is currently registered properly: $config_ip $actual_ip"
fi