Cleaned up 503 section by using warningExplain array
This commit is contained in:
parent
aad6b7876f
commit
afe0440020
51
backup.sh
51
backup.sh
@ -189,58 +189,47 @@ echo -e "${normal}${stamp} mySQL dump file will be stored at:" \
|
|||||||
# Verify 503 existance
|
# Verify 503 existance
|
||||||
if [ -z "$503Location" ]; then
|
if [ -z "$503Location" ]; then
|
||||||
# no 503 file has been provided
|
# no 503 file has been provided
|
||||||
echo -e "${bold}${yellow}${stamp} -- [WARNING] No 503 error page file" \
|
echo -e "${bold}${yellow}${stamp} -- [WARNING] ${warningExplain[5031]}" \
|
||||||
"specified --${normal}" >> "$logFile"
|
"--${normal}" >> "$logFile"
|
||||||
echo -e "${bold}${yellow} Web users will NOT be informed the server" \
|
|
||||||
"is down.${normal}" | tee -a "$logFileNormal" "$logFileVerbose" \
|
|
||||||
> /dev/null
|
|
||||||
exitWarn+=('5031')
|
exitWarn+=('5031')
|
||||||
else
|
else
|
||||||
checkExist "$503Location"
|
checkExist ff "$503Location"
|
||||||
checkResult="$?"
|
checkResult="$?"
|
||||||
if [ "$checkResult" = "1" ]; then
|
if [ "$checkResult" = "1" ]; then
|
||||||
# 503 file specified could not be found
|
# 503 file specified could not be found
|
||||||
echo -e "${bold}${yellow}${stamp} -- [WARNING] 503 error page file" \
|
echo -e "${bold}${yellow}${stamp} -- [WARNING]" \
|
||||||
"specified could not be found --${normal}" >> "$logFile"
|
"${warningExplain[5032]} --${normal}" >> "$logFile"
|
||||||
echo -e "${bold}${yellow} Web users will NOT be informed the server" \
|
|
||||||
"is down.${normal}" | tee -a "$logFileNormal" "$logFileVerbose" \
|
|
||||||
> /dev/null
|
|
||||||
exitWarn+=('5032')
|
exitWarn+=('5032')
|
||||||
else
|
else
|
||||||
# 503 file found, copy it to the webroot after verifying it exists
|
# 503 file found
|
||||||
|
echo -e "${bold}${stamp}Found: ${yellow}${503Location}${normal}" \
|
||||||
|
>> "$logFileVerbose"
|
||||||
|
|
||||||
|
# verify webroot exists
|
||||||
if [ -z "$webroot" ]; then
|
if [ -z "$webroot" ]; then
|
||||||
# no webroot path provided
|
# no webroot path provided
|
||||||
echo -e "${bold}${yellow}${stamp} -- [WARNING] No webroot path" \
|
echo -e "${bold}${yellow}${stamp} -- [WARNING]" \
|
||||||
"specified --${normal}" >> "$logFile"
|
"${warningExplain[5033]} --${normal}" >> "$logFile"
|
||||||
echo -e "${bold}${yellow} Web users will NOT be informed the" \
|
|
||||||
"server is down.${normal}" | tee -a "$logFileNormal" \
|
|
||||||
"$logFileVerbose" > /dev/null
|
|
||||||
exitWarn+=('5033')
|
exitWarn+=('5033')
|
||||||
else
|
else
|
||||||
checkExist "$webroot"
|
# verify provided webroot path exists
|
||||||
|
checkExist fd "$webroot"
|
||||||
checkResult="$?"
|
checkResult="$?"
|
||||||
if [ "$checkResult" = "1" ]; then
|
if [ "$checkResult" = "1" ]; then
|
||||||
# webroot directory specified could not be found
|
# webroot directory specified could not be found
|
||||||
echo -e "${bold}${yellow}${stamp} -- [WARNING] webroot path" \
|
echo -e "${bold}${yellow}${stamp} -- [WARNING]" \
|
||||||
"specified could not be found --${normal}" >> "$logFile"
|
"${warningExplain[5034]} --${normal}" >> "$logFile"
|
||||||
echo -e "${bold}${yellow} Web users will NOT be informed the" \
|
|
||||||
"server is down.${normal}" | tee -a "$logFileNormal" \
|
|
||||||
"$logFileVerbose" > /dev/null
|
|
||||||
exitWarn+=('5034')
|
exitWarn+=('5034')
|
||||||
else
|
else
|
||||||
# webroot exists and 503 exists, copy 503 to webroot
|
# webroot exists and 503 exists, copy 503 to webroot
|
||||||
echo -e "${bold}${cyan}${stamp} Copying 503 error page to" \
|
echo -e "${bold}${cyan}${stamp} Copying 503 error page to" \
|
||||||
"webroot..." >> "$logFileVerbose"
|
"webroot...${normal}" >> "$logFileVerbose"
|
||||||
cp "$503Location" "$webroot/" 2>&1 >> "$logFileVerbose"
|
cp "${503Location}" "$webroot/" >> "$logFileVerbose" 2>&1
|
||||||
copyResult=$( echo "$?" )
|
copyResult="$?"
|
||||||
# verify copy was successful
|
# verify copy was successful
|
||||||
if [ "$copyResult" = "1" ]; then
|
if [ "$copyResult" = "1" ]; then
|
||||||
echo -e "${bold}${yellow}${stamp} -- [WARNING]" \
|
echo -e "${bold}${yellow}${stamp} -- [WARNING]" \
|
||||||
"Error copying 503 error page file to webroot" \
|
"${warningExplain[5035]} --${normal}" >> "$logFile"
|
||||||
"--${normal}" >> "$logFile"
|
|
||||||
echo -e "${bold}${yellow} Web users will NOT be" \
|
|
||||||
"informed the server is down.${normal}" | tee -a \
|
|
||||||
"$logFileNormal" "$logFileVerbose" > /dev/null
|
|
||||||
exitWarn+=('5035')
|
exitWarn+=('5035')
|
||||||
else
|
else
|
||||||
# copy was successful
|
# copy was successful
|
||||||
|
Loading…
Reference in New Issue
Block a user