From c098b5c8fc9bc12f65926219e0861f0e5727ded7 Mon Sep 17 00:00:00 2001 From: Asif Bacchus Date: Thu, 6 Sep 2018 04:28:11 -0600 Subject: [PATCH] Rewrote sqlDump removal and cleaned up the 503 removal section --- root/scripts/borgbackup.sh | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/root/scripts/borgbackup.sh b/root/scripts/borgbackup.sh index b147feb..a4cfbf0 100755 --- a/root/scripts/borgbackup.sh +++ b/root/scripts/borgbackup.sh @@ -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 rm -f "$webroot/$err503FileName" 2>&1 | tee -a $logFileVerbose $logFileNormal \ > /dev/null -echo -e "\e[0;36m...done\e[0m" # verify actually removed checkExist find "" "$webroot/$err503FileName" checkResult="$?" @@ -394,25 +393,29 @@ if [ "$checkResult" = "0" ]; then "Problem encountered removing 503 error page from webroot." \ "Manually remove this file or NGINX will not serve web" \ "clients.--" >> $logFile - echo -e "Script will continue processing..." >> $logFile + echo -e "Script will continue processing..." >> $logFileVerbose exitWarning+=('103') 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 ## Remove sqlDump file echo -e "\e[1;36m[`date +%Y-%m-%d` `date +%H:%M:%S`] Removing sqlDump" \ - "file...\e[0m" >> $logFile -rm -f "$sqlDumpDir/$sqlDumpFile" &>> $logFile + "file...\e[0m" >> $logFileVerbose +rm -f "$sqlDumpDir/$sqlDumpFile" >> $logFile 2>&1 # verify actually removed -if [ -e "$sqlDumpDir/$sqlDumpFile" ]; then - echo -e "\e[1;33m[`date +%Y-%m-%d` `date +%H:%M:%S`] --Warning--" \ - "Error removing sqldump file. Please remove manually.\e[0m" >> $logFile - echo -e "Script will continue processing..." >> $logFile +checkExist find "" "$sqlDumpDir/$sqlDumpFile" +checkResult="$?" +if [ "$checkResult" = "0" ]; then + 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 - echo -e "\e[0;36m...done\e[0m" >> $logFile + echo -e "\e[0;36m...done\e[0m" >> $logFileVerbose fi + ## Log completion of script echo -e "\e[1;32m[`date +%Y-%m-%d` `date +%H:%M:%S`]" \ "--Backup operations completed--\e[0m" >> $logFile