Skip to content

Instantly share code, notes, and snippets.

@MattRK
Last active August 29, 2015 14:03
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MattRK/e822edc5ea35ff128168 to your computer and use it in GitHub Desktop.
Save MattRK/e822edc5ea35ff128168 to your computer and use it in GitHub Desktop.
CloudFlare Dynamic DNS Update Script for AsusWRT-Merlin
#!/bin/sh
#Wait 30 seconds so that the WAN can come up properly before continuing
sleep 30
#Get the new IP
IP=`wget -O - -q http://icanhazip.com`
#Update Cloudflare with the new IP
/opt/bin/wget -O - -q https://www.cloudflare.com/api_json.html --no-check-certificate --post-data "a=rec_edit&tkn=[YOUR API TOKEN]&email=[YOUR EMAIL ADDRESS]&z=[YOUR ZONE NAME]&id=[YOUR RECORD ID]&type=A&name=[RECORD NAME]&ttl=1&content=$IP"
#Log the event
logger DHCPC-EVENT SCRIPT: CloudFlare has been updated to $IP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment