Updated sqlDumpDir check to use new checkExist function
This commit is contained in:
parent
5c142fd329
commit
1ea15caa87
@ -155,29 +155,29 @@ 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${1}\e[0m" >> $logFileVerbose
|
echo -e "\e[0mFound: \e[0;33m${3}\e[0m" >> $logFileVerbose
|
||||||
return 0
|
return 0
|
||||||
elif [ "$2" = "createDir" ]; then
|
elif [ "$2" = "createDir" ]; then
|
||||||
echo -e "\e[1;36mCreating: ${1}...\e[0m" >> $logFileVerbose
|
echo -e "\e[1;36mCreating: ${3}...\e[0m" >> $logFileVerbose
|
||||||
mkdir -p "$1"
|
mkdir -p "$3"
|
||||||
echo -e "\e[0;36m...done\e[0m" >> $logFileVerbose
|
echo -e "\e[0;36m...done\e[0m" >> $logFileVerbose
|
||||||
return 1
|
return 1
|
||||||
elif [ "$2" = "warn" ]; then
|
elif [ "$2" = "warn" ]; then
|
||||||
echo -e "\e[1;33m---WARNING: ${1} was not found---\e[0m" | \
|
echo -e "\e[1;33m---WARNING: ${3} was not found---\e[0m" | \
|
||||||
tee -a $logFileVerbose $logFileNormal >> $logFileQuiet
|
tee -a $logFileVerbose $logFileNormal >> $logFileQuiet
|
||||||
exitWarning=1
|
exitWarning=1
|
||||||
return 2
|
return 2
|
||||||
elif [ "$2" = "error" ]; then
|
elif [ "$2" = "error" ]; then
|
||||||
echo -e "\e[1;31m---ERROR: ${1} was not found---\e[0m" | \
|
echo -e "\e[1;31m---ERROR: ${3} was not found---\e[0m" | \
|
||||||
tee -a $logFileVerbose $logFileNormal >> $logFileQuiet
|
tee -a $logFileVerbose $logFileNormal >> $logFileQuiet
|
||||||
quit 101
|
quit 101
|
||||||
fi
|
fi
|
||||||
elif [ "$1" = "verify" ]; then
|
elif [ "$1" = "verify" ]; then
|
||||||
if [ -e "$3" ]; then
|
if [ -e "$2" ]; then
|
||||||
echo -e "\e[0mConfirmed: \e[0;33m${1}\e[0m" >> $logFileVerbose
|
echo -e "\e[0mConfirmed: \e[0;33m${2}\e[0m" >> $logFileVerbose
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
echo -e "\e[1;31m---ERROR: Problem creating ${1}---\e[0m" | \
|
echo -e "\e[1;31m---ERROR: Problem creating ${2}---\e[0m" | \
|
||||||
tee -a $logFileVerbose $logFileNormal >> $logFileQuiet
|
tee -a $logFileVerbose $logFileNormal >> $logFileQuiet
|
||||||
quit 102
|
quit 102
|
||||||
fi
|
fi
|
||||||
@ -221,6 +221,14 @@ fi
|
|||||||
export logFile="$logFile"
|
export logFile="$logFile"
|
||||||
|
|
||||||
## Check for sqlDumpDir and create if necessary
|
## Check for sqlDumpDir and create if necessary
|
||||||
|
checkExist find createDir $sqlDumpDir
|
||||||
|
checkResult="$?"
|
||||||
|
if [ "$checkResult" = "1" ]; then
|
||||||
|
# verify creation successful
|
||||||
|
checkExist verify $sqlDumpDir
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ -e $sqlDumpDir ]; then
|
if [ -e $sqlDumpDir ]; then
|
||||||
echo -e "\e[0m[`date +%Y-%m-%d` `date +%H:%M:%S`] Confirmed:" \
|
echo -e "\e[0m[`date +%Y-%m-%d` `date +%H:%M:%S`] Confirmed:" \
|
||||||
"sqlDumpDir exists at \e[0;33m$sqlDumpDir\e[0m" >> $logFile
|
"sqlDumpDir exists at \e[0;33m$sqlDumpDir\e[0m" >> $logFile
|
||||||
|
Loading…
Reference in New Issue
Block a user