Create a gist now

Instantly share code, notes, and snippets.

@MattRK /dhcpc-event
Last active Aug 29, 2015

What would you like to do?
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