Created
August 26, 2013 15:41
-
-
Save woods/6342887 to your computer and use it in GitHub Desktop.
Example script to set a dynamic record in DNSimple based on the current cable modem address. This can be run in /etc/cron.hourly.
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 | |
# | |
# Since paig is on a dynamic IP address cable modem, we use this script to | |
# periodically update DNS with the current record. In this case, we're using | |
# the hostname paig.2surfers.com. | |
# | |
# Keep the contents of this file secret, since it contains the domain's API | |
# key. The ID of the record to be updated by hovering over it in DNSimple's | |
# web interface. | |
IP_ADDRESS="`curl -s http://icanhazip.com/`" | |
curl -H 'X-DNSimple-Domain-Token: xxxxxxxxxxxxxxxxxxxxxxxx' \ | |
-H 'Accept: application/json' \ | |
-H 'Content-Type: application/json' \ | |
-k -i -s -X PUT \ | |
-d "{\"record\":{\"content\":\"$IP_ADDRESS\"}}" \ | |
https://dnsimple.com/domains/2surfers.com/records/1612769 > /tmp/update_ip_address.out |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment