From 5ca04a5ecdc3db0d3fb5c3e975dd0c062f9b8e83 Mon Sep 17 00:00:00 2001 From: Asif Bacchus Date: Wed, 12 Sep 2018 03:19:10 -0600 Subject: [PATCH] Check CloudFlare to see if records exist. --- cfddns.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cfddns.sh b/cfddns.sh index 75aea94..a126a1e 100755 --- a/cfddns.sh +++ b/cfddns.sh @@ -148,6 +148,14 @@ if [ -z "$ipAddress" ]; then fi +## Check if desired record(s) exist at CloudFlare +for counter in "${dnsRecords[@]}"; do + record=$(curl -s -X GET "https://api.cloudflare.com/client/v4/zones/ \ + ${cfDetails[2]}/dns_records?name=${dnsRecords[counter]}&type=A" \ + -H "X-Auth-Email: ${cfDetails[0]}" \ + -H "X-Auth-Key: ${cfDetails[1]}" \ + -H "Content-Type: application/json") +done ### Echo results (testing) echo -e "\nBased on parameters provided:"