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

@ -253,49 +253,41 @@ else
>> "$logFile" >> "$logFile"
exitWarn+=('5034') exitWarn+=('5034')
else else
# webroot exists # webroot exists
echo -e "${op}${stamp} Using webroot: ${lit}${webroot}${normal}" \ echo -e "${op}${stamp} Using webroot: ${lit}${webroot}${normal}" \
>> "$logFile"
# Verify 503 existance
checkExist ff "$err503File"
checkResult="$?"
if [ "$checkResult" = "1" ]; then
# 503 file specified could not be found
echo -e "${info}${stamp} -- [INFO] ${warn503} --${normal}" \
>> "$logFile" >> "$logFile"
exitWarn+=('5032') # Verify 503 file existance
else checkExist ff "$err503File"
checkResult="$?"
if [ "$checkResult" = "1" ]; then
# 503 file could not be found
echo -e "${info}${stamp} -- [INFO] ${warn503} --${normal}" \
>> "$logFile"
exitWarn+=('5032')
else else
# verify provided webroot path exists # 503 file exists and webroot is valid. Let's copy it!
checkExist fd "$webroot" echo -e "${op}${stamp} ${err503File} found.${normal}" >> "$logFile"
checkResult="$?" echo -e "${op}${stamp} Copying 503 error page to webroot..." \
if [ "$checkResult" = "1" ]; then "${normal}" >> "$logFile"
# webroot directory specified could not be found cp "${err503File}" "$webroot/" >> "$logFile" 2>&1
echo -e "${info}${stamp} -- [INFO] ${warn503} --${normal}" \ copyResult="$?"
>> "$logFile" # verify copy was successful
exitWarn+=('5034') if [ "$copyResult" = "1" ]; then
else # copy was unsuccessful
# webroot exists and 503 exists, copy 503 to webroot echo -e "${info}${stamp} -- [INFO] ${warn503} --${normal}" \
echo -e "${op}${stamp} Copying 503 error page to webroot" \ >> "$logFile"
"${normal}" >> "$logFile" exitWarn+=('5035')
cp "${err503File}" "$webroot/" >> "$logFile" 2>&1 else
copyResult="$?" # copy was successful
# verify copy was successful echo -e "${info}${stamp} -- [INFO] 503 error page" \
if [ "$copyResult" = "1" ]; then "successfully copied to webroot --${normal}" >> "$logFile"
# copy was unsuccessful fi
echo -e "${info}${stamp} -- [INFO] ${warn503}" \
"--${normal}" >> "$logFile"
exitWarn+=('5035')
else
# copy was successful
echo -e "${op}${stamp} 503 error page" \
"copied to webroot${normal}" >> "$logFile"
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