add schbang

This commit is contained in:
Freya Murphy 2023-09-12 09:05:20 -04:00
parent ea953bfe58
commit 2d67869380
No known key found for this signature in database
GPG key ID: 988032A5638EE799

10
dns.sh
View file

@ -1,3 +1,5 @@
#!/usr/bin/env sh
API_TOKEN="${API_TOKEN:-ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcd}"
ZONE="${ZONE:-example.com}"
DOMAIN="${DOMAIN:-example.com}"
@ -41,7 +43,7 @@ GET() {
CURL "GET" "$1" ""
}
EVENT "Getting Zones"
EVENT "Getting zones"
ZONES=$(GET "/zones")
ZONE_ID="null"
@ -57,7 +59,7 @@ while true; do
NAME=$(echo $ZONE_JSON | jq -r ".name")
ID=$(echo $ZONE_JSON | jq -r ".id")
LOG "Found Zone $NAME ($ID)"
LOG "Found zone $NAME ($ID)"
if [ "$NAME" == "$ZONE" ]; then
ZONE_ID=$ID
@ -73,7 +75,7 @@ if [ "$ZONE_ID" == "null" ]; then
exit 1
fi
EVENT "Getting Records"
EVENT "Getting records"
RECORDS=$(GET "/zones/$ZONE_ID/dns_records")
@ -142,7 +144,7 @@ IPv6JSON="{
\"type\": \"AAAA\"
}"
EVENT "Updating Records"
EVENT "Updating records"
if [ "$IPv4Id" == "null" ]; then
LOG "No IPv4 record found... creating new one"