Added check variable to determine if 503 cleanup required

This commit is contained in:
Asif Bacchus 2018-10-02 00:07:32 -06:00
parent b3d1b3ea65
commit 325805ef37

View File

@ -105,10 +105,10 @@ function cleanup {
fi fi
## remove 503 error page ## remove 503 error page
# check if webroot was specified, if not, then nothing was copied so we can # check value of 'clean503' to see if this is necessary (=1) otherwise, skip
# skip this whole section if [ "$clean503" -eq 1 ]; then
if [ -n "$webroot" ]; then
# proceed with cleanup # proceed with cleanup
echo -e "${op}${stamp} Removing 503 error page..." >> "$logFile"
rm -f "$webroot/$err503File" >> "$logFile" 2>&1 rm -f "$webroot/$err503File" >> "$logFile" 2>&1
# verify file is actually gone # verify file is actually gone
checkExist ff "$webroot/$err503File" checkExist ff "$webroot/$err503File"
@ -122,8 +122,8 @@ function cleanup {
"--${normal}" >> "$logFile" "--${normal}" >> "$logFile"
fi fi
else else
echo -e "${op}${stamp} No webroot specified so no 503 file to remove." \ echo -e "${op}${stamp} 503 error page never copied to webroot," \
>> "$logFile" "nothing to cleanup." >> "$logFile"
fi fi
} }
@ -152,6 +152,7 @@ unset PARAMS
unset sqlDumpDir unset sqlDumpDir
unset webroot unset webroot
unset ncRoot unset ncRoot
unset clean503
errorExplain=() errorExplain=()
exitWarn=() exitWarn=()
warningExplain=() warningExplain=()
@ -250,6 +251,7 @@ if [ -z "$webroot" ]; then
echo -e "${info}${stamp} -- [INFO] ${warn503} --${normal}" \ echo -e "${info}${stamp} -- [INFO] ${warn503} --${normal}" \
>> "$logFile" >> "$logFile"
exitWarn+=('5031') exitWarn+=('5031')
clean503=0
else else
# verify webroot actually exists # verify webroot actually exists
checkExist fd "$webroot" checkExist fd "$webroot"
@ -259,6 +261,7 @@ else
echo -e "${info}${stamp} -- [INFO] ${warn503} --${normal}" \ echo -e "${info}${stamp} -- [INFO] ${warn503} --${normal}" \
>> "$logFile" >> "$logFile"
exitWarn+=('5032') exitWarn+=('5032')
clean503=0
else else
# webroot exists # webroot exists
echo -e "${op}${stamp} Using webroot: ${lit}${webroot}${normal}" \ echo -e "${op}${stamp} Using webroot: ${lit}${webroot}${normal}" \
@ -271,6 +274,7 @@ else
echo -e "${info}${stamp} -- [INFO] ${warn503} --${normal}" \ echo -e "${info}${stamp} -- [INFO] ${warn503} --${normal}" \
>> "$logFile" >> "$logFile"
exitWarn+=('5033') exitWarn+=('5033')
clean503=0
else else
# 503 file exists and webroot is valid. Let's copy it! # 503 file exists and webroot is valid. Let's copy it!
echo -e "${op}${stamp} ${err503File} found.${normal}" >> "$logFile" echo -e "${op}${stamp} ${err503File} found.${normal}" >> "$logFile"
@ -284,10 +288,12 @@ else
echo -e "${info}${stamp} -- [INFO] ${warn503} --${normal}" \ echo -e "${info}${stamp} -- [INFO] ${warn503} --${normal}" \
>> "$logFile" >> "$logFile"
exitWarn+=('5035') exitWarn+=('5035')
clean503=0
else else
# copy was successful # copy was successful
echo -e "${info}${stamp} -- [INFO] 503 error page" \ echo -e "${info}${stamp} -- [INFO] 503 error page" \
"successfully copied to webroot --${normal}" >> "$logFile" "successfully copied to webroot --${normal}" >> "$logFile"
clean503=1
fi fi
fi fi
fi fi