aboutsummaryrefslogtreecommitdiff
path: root/scripts/gandi-update
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2020-02-06 01:09:01 +0100
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2020-02-06 01:09:01 +0100
commit40c8f8269238a4ba28dccd619551c370c42858dd (patch)
tree7a7da5f3a08cf278abc4ff664a37a9fd0f3f8489 /scripts/gandi-update
parent801ef3965191aae15e1ffd482bec642bac6c7105 (diff)
downloaddotfiles-40c8f8269238a4ba28dccd619551c370c42858dd.tar.gz
addad gandi-update
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
+