Log script start and mode

This commit is contained in:
Asif Bacchus 2018-09-13 21:25:12 -06:00
parent 26042b952e
commit d9d5f71b5a
1 changed files with 13 additions and 0 deletions

View File

@ -188,6 +188,10 @@ while getopts ':f:r:i:46hxlv' PARAMS; do
esac
done
# Log beginning of script
echo -e "\e[1;32m [`date %Y-%m-%d` `date %H:%M:%S`] -- Start script execution" \
"--\e[0m" >> $logFile
# Check validity of parameters
if [ -z "$accountFile" ] || [[ $accountFile == -* ]]; then
quit 101
@ -197,6 +201,15 @@ elif [ -z ${dnsRecords} ]; then
quit 103
fi
# Log operating mode
if [ $ip4 -eq 1 ]; then
echo -e "\e[1;36m [`date %Y-%m-%d` `date %H:%M:%S`] Script running in IP4" \
"mode\e[0m" >> $logFile
elif [ $ip6 -eq 1 ]; then
echo -e "\e[1;36m [`date %Y-%m-%d` `date %H:%M:%S`] Script running in IP6" \
"mode\e[0m" >> $logFile
fi
## Extract needed information from accountDetails file
mapfile -t cfDetails < "$accountFile"