checkExist: Added timestamps

This commit is contained in:
Asif Bacchus 2018-09-06 02:07:21 -06:00
parent 3fc85fb037
commit e255bfb8c8

View File

@ -155,33 +155,39 @@ function quit {
function checkExist { function checkExist {
if [ "$1" = "find" ]; then if [ "$1" = "find" ]; then
if [ -e "$3" ]; then if [ -e "$3" ]; then
echo -e "\e[0mFound: \e[0;33m${3}\e[0m" >> $logFileVerbose echo -e "\e[0m[`date +%Y-%m-%d` `date +%H:%M:%S`] Found:" \
"\e[0;33m${3}\e[0m" >> $logFileVerbose
return 0 return 0
elif [ "$2" = "createDir" ]; then elif [ "$2" = "createDir" ]; then
echo -e "\e[1;36mCreating: ${3}...\e[0m" | tee -a $logFileVerbose \ echo -e "\e[1;36m[`date +%Y-%m-%d` `date +%H:%M:%S`] Creating:" \
$logFileNormal > /dev/null "${3}...\e[0m" | tee -a $logFileVerbose $logFileNormal > \
/dev/null
mkdir -p "$3" 2>&1 | tee -a $logFileVerbose $logFileNormal \ mkdir -p "$3" 2>&1 | tee -a $logFileVerbose $logFileNormal \
> /dev/null > /dev/null
echo -e "\e[0;36m...done\e[0m" | tee -a $logFileVerbose \ echo -e "\e[0;36m...done\e[0m" | tee -a $logFileVerbose \
$logFileNormal > /dev/null $logFileNormal > /dev/null
return 1 return 1
elif [ "$2" = "warn" ]; then elif [ "$2" = "warn" ]; then
echo -e "\e[1;33m---WARNING: ${3} was not found---\e[0m" | \ echo -e "\e[1;33m[`date +%Y-%m-%d` `date +%H:%M:%S`] ---WARNING:" \
tee -a $logFileVerbose $logFileNormal $logFileQuiet > /dev/null "${3} was not found---\e[0m" | tee -a $logFileVerbose \
$logFileNormal $logFileQuiet > /dev/null
exitWarning=101 exitWarning=101
return 2 return 2
elif [ "$2" = "error" ]; then elif [ "$2" = "error" ]; then
echo -e "\e[1;31m---ERROR: ${3} was not found---\e[0m" | \ echo -e "\e[1;31m[`date +%Y-%m-%d` `date +%H:%M:%S`] ---ERROR:" \
tee -a $logFileVerbose $logFileNormal $logFileQuiet > /dev/null "${3} was not found---\e[0m" | tee -a $logFileVerbose \
$logFileNormal $logFileQuiet > /dev/null
quit 101 quit 101
fi fi
elif [ "$1" = "verify" ]; then elif [ "$1" = "verify" ]; then
if [ -e "$2" ]; then if [ -e "$2" ]; then
echo -e "\e[0mConfirmed: \e[0;33m${2}\e[0m" >> $logFileVerbose echo -e "\e[0m[`date +%Y-%m-%d` `date +%H:%M:%S`]Confirmed:" \
"\e[0;33m${2}\e[0m" >> $logFileVerbose
return 0 return 0
else else
echo -e "\e[1;31m---ERROR: Problem creating ${2}---\e[0m" | \ echo -e "\e[1;31m[`date +%Y-%m-%d` `date +%H:%M:%S`] ---ERROR:" \
tee -a $logFileVerbose $logFileNormal $logFileQuiet > /dev/null "Problem creating ${2}---\e[0m" | tee -a $logFileVerbose \
$logFileNormal $logFileQuiet > /dev/null
quit 102 quit 102
fi fi
fi fi