diff --git a/root/scripts/borgbackup.sh b/root/scripts/borgbackup.sh index 80f5618..446952e 100755 --- a/root/scripts/borgbackup.sh +++ b/root/scripts/borgbackup.sh @@ -137,3 +137,35 @@ echo -e "\e[0m[`date +%Y-%m-%d` `date +%H:%M:%S`] mysql dump file will be" \ "stored at:" >> $logFile echo -e "\e[0;33m$sqlDumpDir/$sqlDumpFile\e[0m" >> $logFile +## Find 503 error page and copy to NGINX webroot +## File must be in the same location as this script +## IF file is not found, log warning but continue script +if [ -e $err503FullPath ]; then + echo -e "\e[0m[`date +%Y-%m-%d` `date +%H:%M:%S`] Found 503 error" \ + "page at:" >> $logFile + echo -e "\e[0;33m$err503FullPath\e[0m" >> $logFile + # copy 503 to webroot + echo -e "\e[1;36m[`date +%Y-%m-%d` `date +%H:%M:%S`] Copying 503 error" \ + "page to NGINX webroot..." >> $logFile + cp $err503FullPath $webroot/ &>> $logFile + # check file actually copied + if [ -e "$webroot/$err503FileName" ]; then + echo -e "\e[0;36m...done\e[0m" >> $logFile + else + echo -e "\e[1;33m[`date +%Y-%m-%d` `date +%H:%M:%S`] --Warning--" \ + "There was a problem copying the 503 error page to" \ + "webroot." >> $logFile + echo -e "\e[1;33m--Warning-- Web users will NOT be notified the" \ + "server is down.\e[0m" >> $logFile + echo -e "Script will continue processing..." >> $logFile + fi +else + echo -e "\e[1;33m[`date +%Y-%m-%d` `date +%H:%M:%S`] --Warning--" \ + "Could not locate 503 error page at \e[0;33m$err503FullPath" >> $logFile + echo -e "\e[1;33m--Warning-- This file should be re-created" \ + "ASAP." >> $logFile + echo -e "\e[1;33m--Warning-- Web users will NOT be notified the" \ + "server is down.\e[0m" >> $logFile + echo -e "Script will continue processing..." >> $logFile +fi +