Created
June 12, 2016 11:00
-
-
Save pinglamb/f86084b8c5e726d49b78dd43cad3aabf to your computer and use it in GitHub Desktop.
Cloudflare ASUS Custom DDNS Script
This file contains hidden or 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/sh | |
EMAIL= # Your Email | |
ZONEID= # Your zone id, hex16 string | |
RECORDID= # You DNS record ID, hex16 string | |
RECORDNAME= # Your DNS record name, e.g. sub.example.com | |
API= # Cloudflare API Key | |
IP=${1} | |
curl -fs -o /dev/null -XPUT "https://api.cloudflare.com/client/v4/zones/$ZONEID/dns_records/$RECORDID" \ | |
-H "X-Auth-Email: $EMAIL" \ | |
-H "X-Auth-Key: $API" \ | |
-H "Content-Type: application/json" \ | |
--data "{\"id\":\"$RECORDID\",\"type\":\"A\",\"name\":\"$RECORDNAME\",\"content\":\"$IP\",\"zone_id\":\"$ZONEID\"}" | |
if [ $? -eq 0 ]; then | |
/sbin/ddns_custom_updated 1 | |
else | |
/sbin/ddns_custom_updated 0 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment