Created
June 16, 2019 03:55
-
-
Save ckunte/d2bacfd69bea1975b1c23e2c5247f1c7 to your computer and use it in GitHub Desktop.
DDNS setup for IP refresh using DNSimple
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# setup in /etc/anacrontab: | |
# 1 5 ping.daily /home/ckunte/.ddns/ddns.sh | |
# | |
TOKEN="<add token here>" # The API v2 OAuth token | |
ACCOUNT_ID="<add id here>" # Replace with your account ID | |
ZONE_ID="<add domain name here>" # The zone ID is the name of the zone (or domain) | |
RECORD_ID="<add record id here>" # Replace with the DNS Record ID (corresponds to A record) | |
IP=`curl -s http://icanhazip.com/` | |
curl -H "Authorization: Bearer $TOKEN" \ | |
-H "Content-Type: application/json" \ | |
-H "Accept: application/json" \ | |
-X "PATCH" \ | |
-i "https://api.dnsimple.com/v2/$ACCOUNT_ID/zones/$ZONE_ID/records/$RECORD_ID" \ | |
-d "{\"content\":\"$IP\"}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment