-
-
Save Rmlyy/e07f696a93ff5b24b053f4b1382c4f05 to your computer and use it in GitHub Desktop.
Minimal Cloudflare Dynamic DNS
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/bash | |
ip=$(curl -s myipv4.r0.al) | |
date=$(date +'[%m.%d.%Y %r]:') | |
api_key="" | |
zone_id="" | |
dns_identifier="" | |
name="" | |
curl -s -f -X PUT "https://api.cloudflare.com/client/v4/zones/$zone_id/dns_records/$dns_identifier" \ | |
-H "Authorization: Bearer $api_key" \ | |
-H "Content-Type: application/json" \ | |
--data '{"type":"A","name":"'$name'","content":"'$ip'","ttl":0,"proxied":false}' &>/dev/null && echo "$date Success: $ip" > ~/cf-ddns/output.log || echo "$date Failed" >> ~/cf-ddns/output.log |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
10/10