summaryrefslogtreecommitdiff
path: root/scripts/gandi-update
blob: 502e861dbee0ffbdc2c03ccb49933fb1d01192ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash
# DNS Record update script for gandi.net API
# for use as DynDNS

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