Skip to content

Instantly share code, notes, and snippets.

@Rmlyy
Created March 12, 2022 17:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Rmlyy/e07f696a93ff5b24b053f4b1382c4f05 to your computer and use it in GitHub Desktop.
Save Rmlyy/e07f696a93ff5b24b053f4b1382c4f05 to your computer and use it in GitHub Desktop.
Minimal Cloudflare Dynamic DNS
#!/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
@Wreeper
Copy link

Wreeper commented Mar 12, 2022

10/10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment