aboutsummaryrefslogtreecommitdiff
path: root/scripts/gandi-update
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/gandi-update')
-rwxr-xr-xscripts/gandi-update15
1 files changed, 15 insertions, 0 deletions
diff --git a/scripts/gandi-update b/scripts/gandi-update
new file mode 100755
index 0000000..496eb9c
--- /dev/null
+++ b/scripts/gandi-update
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+APIKEY=
+TTL=1800
+DOMAIN=
+RECORD=
+TYPE=A
+
+IP=$(dig -4 +short myip.opendns.com @resolver1.opendns.com)
+
+REQUEST="{\"rrset_ttl\": $TTL, \"rrset_values\": [\"$IP\"]}"
+URL="https://dns.api.gandi.net/api/v5/domains/$DOMAIN/records/$RECORD/$TYPE"
+
+curl -D- -X PUT -H "Content-Type: application/json" -H "X-Api-Key: $APIKEY" -d "$REQUEST" $URL
+