Skip to content

Instantly share code, notes, and snippets.

@euyuil
Last active April 10, 2019 06:53
Show Gist options
  • Save euyuil/36e4402c50f1f6adf183a9411b5305a2 to your computer and use it in GitHub Desktop.
Save euyuil/36e4402c50f1f6adf183a9411b5305a2 to your computer and use it in GitHub Desktop.
Gandi.net: Dynamic DNS crontab script
#!/bin/bash
# https://doc.livedns.gandi.net/
# https://www.ipify.org/
APIKEY='YourKeyGoesHere'
DOMAIN='example.com'
NAME='@'
IPADDR=`curl -s https://api.ipify.org/`
curl -s -X PUT \
-H "Content-Type: application/json" \
-H "X-Api-Key: $APIKEY" \
-d "{\"rrset_ttl\":300,\"rrset_values\":[\"$IPADDR\"]}" \
https://dns.api.gandi.net/api/v5/domains/$DOMAIN/records/$NAME/A
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment