add schbang
This commit is contained in:
parent
ea953bfe58
commit
2d67869380
1 changed files with 6 additions and 4 deletions
10
dns.sh
10
dns.sh
|
@ -1,3 +1,5 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
API_TOKEN="${API_TOKEN:-ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcd}"
|
API_TOKEN="${API_TOKEN:-ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcd}"
|
||||||
ZONE="${ZONE:-example.com}"
|
ZONE="${ZONE:-example.com}"
|
||||||
DOMAIN="${DOMAIN:-example.com}"
|
DOMAIN="${DOMAIN:-example.com}"
|
||||||
|
@ -41,7 +43,7 @@ GET() {
|
||||||
CURL "GET" "$1" ""
|
CURL "GET" "$1" ""
|
||||||
}
|
}
|
||||||
|
|
||||||
EVENT "Getting Zones"
|
EVENT "Getting zones"
|
||||||
ZONES=$(GET "/zones")
|
ZONES=$(GET "/zones")
|
||||||
ZONE_ID="null"
|
ZONE_ID="null"
|
||||||
|
|
||||||
|
@ -57,7 +59,7 @@ while true; do
|
||||||
NAME=$(echo $ZONE_JSON | jq -r ".name")
|
NAME=$(echo $ZONE_JSON | jq -r ".name")
|
||||||
ID=$(echo $ZONE_JSON | jq -r ".id")
|
ID=$(echo $ZONE_JSON | jq -r ".id")
|
||||||
|
|
||||||
LOG "Found Zone $NAME ($ID)"
|
LOG "Found zone $NAME ($ID)"
|
||||||
|
|
||||||
if [ "$NAME" == "$ZONE" ]; then
|
if [ "$NAME" == "$ZONE" ]; then
|
||||||
ZONE_ID=$ID
|
ZONE_ID=$ID
|
||||||
|
@ -73,7 +75,7 @@ if [ "$ZONE_ID" == "null" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
EVENT "Getting Records"
|
EVENT "Getting records"
|
||||||
|
|
||||||
RECORDS=$(GET "/zones/$ZONE_ID/dns_records")
|
RECORDS=$(GET "/zones/$ZONE_ID/dns_records")
|
||||||
|
|
||||||
|
@ -142,7 +144,7 @@ IPv6JSON="{
|
||||||
\"type\": \"AAAA\"
|
\"type\": \"AAAA\"
|
||||||
}"
|
}"
|
||||||
|
|
||||||
EVENT "Updating Records"
|
EVENT "Updating records"
|
||||||
|
|
||||||
if [ "$IPv4Id" == "null" ]; then
|
if [ "$IPv4Id" == "null" ]; then
|
||||||
LOG "No IPv4 record found... creating new one"
|
LOG "No IPv4 record found... creating new one"
|
||||||
|
|
Loading…
Reference in a new issue