Rewrote sqlDump removal and cleaned up the 503 removal section

This commit is contained in:
Asif Bacchus 2018-09-06 04:28:11 -06:00
parent 700d04d544
commit c098b5c8fc

View File

@ -385,7 +385,6 @@ echo -e "\e[1;36m[`date +%Y-%m-%d` `date +%H:%M:%S`] Removing 503 error page" \
"from webroot...\e[0m" | tee -a $logFileVerbose $logFileNormal > /dev/null "from webroot...\e[0m" | tee -a $logFileVerbose $logFileNormal > /dev/null
rm -f "$webroot/$err503FileName" 2>&1 | tee -a $logFileVerbose $logFileNormal \ rm -f "$webroot/$err503FileName" 2>&1 | tee -a $logFileVerbose $logFileNormal \
> /dev/null > /dev/null
echo -e "\e[0;36m...done\e[0m"
# verify actually removed # verify actually removed
checkExist find "" "$webroot/$err503FileName" checkExist find "" "$webroot/$err503FileName"
checkResult="$?" checkResult="$?"
@ -394,25 +393,29 @@ if [ "$checkResult" = "0" ]; then
"Problem encountered removing 503 error page from webroot." \ "Problem encountered removing 503 error page from webroot." \
"Manually remove this file or NGINX will not serve web" \ "Manually remove this file or NGINX will not serve web" \
"clients.--" >> $logFile "clients.--" >> $logFile
echo -e "Script will continue processing..." >> $logFile echo -e "Script will continue processing..." >> $logFileVerbose
exitWarning+=('103') exitWarning+=('103')
else else
echo -e "\e[0;36m...done\e[0m" >> $logFile echo -e "\e[0;36m...done\e[0m" | tee -a $logFileVerbose $logFileNormal \
> /dev/null
fi fi
## Remove sqlDump file ## Remove sqlDump file
echo -e "\e[1;36m[`date +%Y-%m-%d` `date +%H:%M:%S`] Removing sqlDump" \ echo -e "\e[1;36m[`date +%Y-%m-%d` `date +%H:%M:%S`] Removing sqlDump" \
"file...\e[0m" >> $logFile "file...\e[0m" >> $logFileVerbose
rm -f "$sqlDumpDir/$sqlDumpFile" &>> $logFile rm -f "$sqlDumpDir/$sqlDumpFile" >> $logFile 2>&1
# verify actually removed # verify actually removed
if [ -e "$sqlDumpDir/$sqlDumpFile" ]; then checkExist find "" "$sqlDumpDir/$sqlDumpFile"
echo -e "\e[1;33m[`date +%Y-%m-%d` `date +%H:%M:%S`] --Warning--" \ checkResult="$?"
"Error removing sqldump file. Please remove manually.\e[0m" >> $logFile if [ "$checkResult" = "0" ]; then
echo -e "Script will continue processing..." >> $logFile echo -e "\e[1;33m[`date +%Y-%m-%d` `date +%H:%M:%S`] --WARNING:" \
"Error removing sqldump file. Please remove manually.\e[0m--" >> $logFileVerbose
echo -e "Script will continue processing..." >> $logFileVerbose
else else
echo -e "\e[0;36m...done\e[0m" >> $logFile echo -e "\e[0;36m...done\e[0m" >> $logFileVerbose
fi fi
## Log completion of script ## Log completion of script
echo -e "\e[1;32m[`date +%Y-%m-%d` `date +%H:%M:%S`]" \ echo -e "\e[1;32m[`date +%Y-%m-%d` `date +%H:%M:%S`]" \
"--Backup operations completed--\e[0m" >> $logFile "--Backup operations completed--\e[0m" >> $logFile