Rewrote 503 section to use checkExist
This commit is contained in:
parent
2c51deb600
commit
213210eef4
@ -247,6 +247,36 @@ echo -e "\e[0;33m$sqlDumpDir/$sqlDumpFile\e[0m" | tee -a $logFileVerbose \
|
|||||||
## Find 503 error page and copy to NGINX webroot
|
## Find 503 error page and copy to NGINX webroot
|
||||||
## File must be in the same location as this script
|
## File must be in the same location as this script
|
||||||
## IF file is not found, log warning but continue script
|
## IF file is not found, log warning but continue script
|
||||||
|
checkExist find warn $err503FullPath
|
||||||
|
checkResult="$?"
|
||||||
|
if [ "$checkResult" = "2" ]; then
|
||||||
|
# file not found, issue warning
|
||||||
|
echo -e "\e[1;33m--Warning-- The 503 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
|
||||||
|
else
|
||||||
|
# file found, copy it 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/ 2>&1 | tee $logFileVerbose $logFileNormal \
|
||||||
|
> /dev/null
|
||||||
|
# verify copy was successful
|
||||||
|
checkExist find warn "$webroot/$err503FileName"
|
||||||
|
checkResult="$?"
|
||||||
|
if [ "$checkResult" = "2" ]; then
|
||||||
|
# file not found, issue warning
|
||||||
|
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
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ -e $err503FullPath ]; then
|
if [ -e $err503FullPath ]; then
|
||||||
echo -e "\e[0m[`date +%Y-%m-%d` `date +%H:%M:%S`] Found 503 error" \
|
echo -e "\e[0m[`date +%Y-%m-%d` `date +%H:%M:%S`] Found 503 error" \
|
||||||
"page at:" >> $logFile
|
"page at:" >> $logFile
|
||||||
|
Loading…
Reference in New Issue
Block a user