aboutsummaryrefslogtreecommitdiff
path: root/scripts/gandi-update
blob: 496eb9c9be2067908c8488a0682b3ab1a0175546 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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