From 30b1f2a4d705cf9611b5e91978afcdd1d5eeeb62 Mon Sep 17 00:00:00 2001 From: Asif Bacchus Date: Tue, 4 Sep 2018 18:30:38 -0600 Subject: [PATCH] Added 503 copy section --- root/scripts/borgbackup.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) 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 +