Compare commits

...

6 Commits

Author SHA1 Message Date
Asif Bacchus 07820587d8 Changed colour used for STATUS update.
Fixed typo in "Script Completed" notation.
2018-09-25 18:43:35 -06:00
Asif Bacchus b49be41577 Fixed spacing typo 2018-09-25 18:41:40 -06:00
Asif Bacchus c7618c7a4b Changed logfile notation for IP4 vs IP6 hostname list 2018-09-25 18:39:23 -06:00
Asif Bacchus f8a23992ea Fixed timestamp variable 2018-09-25 18:38:48 -06:00
Asif Bacchus 523c9984a6 Added INFO log tags to hostname lookup list 2018-09-25 18:36:40 -06:00
Asif Bacchus a09dac147a Updated help text 2018-09-25 18:24:06 -06:00
1 changed files with 6 additions and 6 deletions

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.ext.log in same directory as this script"
echo -e "\tDefault: scriptname.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="${stamp}"
stamp="[`date +%Y-%m-%d` `date +%H:%M:%S`]"
# 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} (IP4 lookup: ${dnsRecords[*]})" \
echo -e "${normal}${stamp} [INFO] Updating A records: ${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} (IP6 lookup: ${dnsRecords[*]})" \
echo -e "${normal}${stamp} [INFO] Updating AAAA records: ${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 "${lit}${stamp} -- [STATUS]" \
echo -e "${info}${stamp} -- [STATUS]" \
"${dnsRecords[recordIdx]} needs updating...${normal}" \
>> "$logFile"
if [ $ip4 -eq 1 ]; then