Added cleanup skip 503 if null

This commit is contained in:
Asif Bacchus 2018-09-30 20:00:39 -06:00
parent 1d8909dbe0
commit 370d9d34a7

View File

@ -89,7 +89,7 @@ function ncMaint {
### cleanup - cleanup files and directories created by this script ### cleanup - cleanup files and directories created by this script
function cleanup { function cleanup {
# remove SQL dump file and directory ## remove SQL dump file and directory
rm -rf "$sqlDumpDir" >> "$logFile" 2>&1 rm -rf "$sqlDumpDir" >> "$logFile" 2>&1
# verify directory is gone # verify directory is gone
checkExist fd "$sqlDumpDir" checkExist fd "$sqlDumpDir"
@ -103,18 +103,22 @@ function cleanup {
>> "$logFile" >> "$logFile"
fi fi
# remove 503 error page ## remove 503 error page
rm -f "$webroot/$err503File" >> "$logFile" 2>&1 # check if 503 page was specified to begin with
# verify file is actually gone if [ -n "$err503File" ]; then
checkExist ff "$webroot/$err503File" # proceed with cleanup
checkResult="$?" rm -f "$webroot/$err503File" >> "$logFile" 2>&1
if [ "$checkResult" = "0" ]; then # verify file is actually gone
# file still exists checkExist ff "$webroot/$err503File"
exitWarn+=('5030') checkResult="$?"
else if [ "$checkResult" = "0" ]; then
# file removed # file still exists
echo -e "${bold}${cyan}${stamp} Removed 503 error page from webroot" \ exitWarn+=('5030')
"${normal}" >> "$logFile" else
# file removed
echo -e "${bold}${cyan}${stamp} Removed 503 error page" \
"from webroot${normal}" >> "$logFile"
fi
fi fi
} }