summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteph Enders <steph@senders.io>2023-12-28 07:53:05 -0500
committerSteph Enders <steph@senders.io>2023-12-28 07:53:05 -0500
commit7523f807dd8ef1665c0f8d61d8cdc46ebb673739 (patch)
tree85c996d4bd25ded389baeaf3df83e293a5c3f9ff
parent34e0a59ed43da009d2780d19eaff86189d210c95 (diff)
Add status logging
-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