Compare commits

..

No commits in common. "07820587d8406239da1672434aaf1ed5e9c69b41" and "8a0362a6e1cb853326b0b94b44d863e8075d71e5" have entirely different histories.

View File

@ -35,7 +35,7 @@ echo -e "\tmachine's IP6 address can be correctly detected externally."
echo -e "-h\tDisplay this help page"
echo -e "-x\tDisplay script examples"
echo -e "-l\tLocation for log file output"
echo -e "\tDefault: scriptname.log in same directory as this script"
echo -e "\tDefault: scriptname.ext.log in same directory as this script"
echo -e "\n\e[1;39mExamples:"
echo -e "\e[0;39mRun \e[1;36m$(basename ${0}) \e[1;92m-x\e[0m\n"
echo -e "\n"
@ -82,7 +82,7 @@ quit none
function quit {
if [ -z "$1" ]; then
# exit cleanly
echo -e "${bold}${note}${stamp} -- Script completed --${normal}" \
echo -e "${bold}${note}${stamp} -- Script completed --\${normal}" \
>> "$logFile"
exit 0
elif [ "$1" = "none" ]; then
@ -128,7 +128,7 @@ ip6=0
### define script variables
# timestamp
stamp="[`date +%Y-%m-%d` `date +%H:%M:%S`]"
stamp="${stamp}"
# formatting
normal="\e[0m"
bold="\e[1m"
@ -261,13 +261,13 @@ echo -e "${info}${stamp} [INFO] Using IP address:" \
## Check if desired record(s) exist at CloudFlare
# perform checks on A or AAAA records based on invocation options
if [ $ip4 -eq 1 ]; then
echo -e "${normal}${stamp} [INFO] Updating A records: ${dnsRecords[*]}" \
echo -e "${normal}${stamp} (IP4 lookup: ${dnsRecords[*]})" \
>> "$logFile"
for cfLookup in "${dnsRecords[@]}"; do
cfRecords+=("$(curl -s -X GET "https://api.cloudflare.com/client/v4/zones/${cfDetails[2]}/dns_records?name=$cfLookup&type=A" -H "X-Auth-Email: ${cfDetails[0]}" -H "X-Auth-Key: ${cfDetails[1]}" -H "Content-Type: application/json")")
done
elif [ $ip6 -eq 1 ]; then
echo -e "${normal}${stamp} [INFO] Updating AAAA records: ${dnsRecords[*]}" \
echo -e "${normal}${stamp} (IP6 lookup: ${dnsRecords[*]})" \
>> "$logFile"
for cfLookup in "${dnsRecords[@]}"; do
cfRecords+=("$(curl -s -X GET "https://api.cloudflare.com/client/v4/zones/${cfDetails[2]}/dns_records?name=$cfLookup&type=AAAA" -H "X-Auth-Email: ${cfDetails[0]}" -H "X-Auth-Key: ${cfDetails[1]}" -H "Content-Type: application/json")")
@ -329,7 +329,7 @@ for recordIdx in "${!currentIP[@]}"; do
"${dnsRecords[recordIdx]} is up-to-date.${normal}" \
>> "$logFile"
else
echo -e "${info}${stamp} -- [STATUS]" \
echo -e "${lit}${stamp} -- [STATUS]" \
"${dnsRecords[recordIdx]} needs updating...${normal}" \
>> "$logFile"
if [ $ip4 -eq 1 ]; then