Rewrote 503 copy to webroot and verify section.

This commit is contained in:
Asif Bacchus 2018-10-01 23:10:20 -06:00
parent 0e2fa901f1
commit fc0a7c056c

View File

@ -256,46 +256,38 @@ else
# webroot exists # webroot exists
echo -e "${op}${stamp} Using webroot: ${lit}${webroot}${normal}" \ echo -e "${op}${stamp} Using webroot: ${lit}${webroot}${normal}" \
>> "$logFile" >> "$logFile"
# Verify 503 existance # Verify 503 file existance
checkExist ff "$err503File" checkExist ff "$err503File"
checkResult="$?" checkResult="$?"
if [ "$checkResult" = "1" ]; then if [ "$checkResult" = "1" ]; then
# 503 file specified could not be found # 503 file could not be found
echo -e "${info}${stamp} -- [INFO] ${warn503} --${normal}" \ echo -e "${info}${stamp} -- [INFO] ${warn503} --${normal}" \
>> "$logFile" >> "$logFile"
exitWarn+=('5032') exitWarn+=('5032')
else else
else # 503 file exists and webroot is valid. Let's copy it!
# verify provided webroot path exists echo -e "${op}${stamp} ${err503File} found.${normal}" >> "$logFile"
checkExist fd "$webroot" echo -e "${op}${stamp} Copying 503 error page to webroot..." \
checkResult="$?"
if [ "$checkResult" = "1" ]; then
# webroot directory specified could not be found
echo -e "${info}${stamp} -- [INFO] ${warn503} --${normal}" \
>> "$logFile"
exitWarn+=('5034')
else
# webroot exists and 503 exists, copy 503 to webroot
echo -e "${op}${stamp} Copying 503 error page to webroot" \
"${normal}" >> "$logFile" "${normal}" >> "$logFile"
cp "${err503File}" "$webroot/" >> "$logFile" 2>&1 cp "${err503File}" "$webroot/" >> "$logFile" 2>&1
copyResult="$?" copyResult="$?"
# verify copy was successful # verify copy was successful
if [ "$copyResult" = "1" ]; then if [ "$copyResult" = "1" ]; then
# copy was unsuccessful # copy was unsuccessful
echo -e "${info}${stamp} -- [INFO] ${warn503}" \ echo -e "${info}${stamp} -- [INFO] ${warn503} --${normal}" \
"--${normal}" >> "$logFile" >> "$logFile"
exitWarn+=('5035') exitWarn+=('5035')
else else
# copy was successful # copy was successful
echo -e "${op}${stamp} 503 error page" \ echo -e "${info}${stamp} -- [INFO] 503 error page" \
"copied to webroot${normal}" >> "$logFile" "successfully copied to webroot --${normal}" >> "$logFile"
fi
fi fi
fi fi
fi fi
fi fi
### --- End 503 section ---
### Put NextCloud in maintenance mode ### Put NextCloud in maintenance mode
#ncMaint on #ncMaint on