Moved cleanup call after exitError counter update
This commit is contained in:
parent
929f1cef9b
commit
4532ec5eb5
16
backup.sh
16
backup.sh
@ -435,8 +435,8 @@ if [ "$maintResult" = "0" ]; then
|
|||||||
echo -e "${info}${stamp} -- [INFO] NextCloud now in maintenance mode --" \
|
echo -e "${info}${stamp} -- [INFO] NextCloud now in maintenance mode --" \
|
||||||
"${normal}" >> "$logFile"
|
"${normal}" >> "$logFile"
|
||||||
else
|
else
|
||||||
cleanup
|
|
||||||
exitError+=('100')
|
exitError+=('100')
|
||||||
|
cleanup
|
||||||
quit
|
quit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -456,8 +456,8 @@ if [ "$dumpResult" = "0" ]; then
|
|||||||
echo -e "${ok}${stamp} -- [SUCCESS] SQL dumped successfully --${normal}" \
|
echo -e "${ok}${stamp} -- [SUCCESS] SQL dumped successfully --${normal}" \
|
||||||
>> "$logFile"
|
>> "$logFile"
|
||||||
else
|
else
|
||||||
cleanup
|
|
||||||
exitError+=('200')
|
exitError+=('200')
|
||||||
|
cleanup
|
||||||
quit
|
quit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -473,8 +473,8 @@ mapfile -t borgConfig < "$borgDetails"
|
|||||||
# check: borg base directory
|
# check: borg base directory
|
||||||
echo -e "${op}${stamp} Verifying supplied borg configuration variables..."
|
echo -e "${op}${stamp} Verifying supplied borg configuration variables..."
|
||||||
if [ -z "${borgConfig[0]}" ]; then
|
if [ -z "${borgConfig[0]}" ]; then
|
||||||
cleanup
|
|
||||||
exitError+=('210')
|
exitError+=('210')
|
||||||
|
cleanup
|
||||||
quit
|
quit
|
||||||
else
|
else
|
||||||
# verify the path actually exists
|
# verify the path actually exists
|
||||||
@ -482,8 +482,8 @@ else
|
|||||||
checkResult="$?"
|
checkResult="$?"
|
||||||
if [ "$checkResult" = "1" ]; then
|
if [ "$checkResult" = "1" ]; then
|
||||||
# borg base directory specified could not be found
|
# borg base directory specified could not be found
|
||||||
cleanup
|
|
||||||
exitError+=('210')
|
exitError+=('210')
|
||||||
|
cleanup
|
||||||
quit
|
quit
|
||||||
fi
|
fi
|
||||||
echo -e "${op}${stamp} Borg base dir... OK${normal}" >> "$logFile"
|
echo -e "${op}${stamp} Borg base dir... OK${normal}" >> "$logFile"
|
||||||
@ -491,16 +491,16 @@ else
|
|||||||
fi
|
fi
|
||||||
# check: path to SSH keyfile
|
# check: path to SSH keyfile
|
||||||
if [ -z "${borgConfig[1]}" ]; then
|
if [ -z "${borgConfig[1]}" ]; then
|
||||||
cleanup
|
|
||||||
exitError+=('211')
|
exitError+=('211')
|
||||||
|
cleanup
|
||||||
quit
|
quit
|
||||||
else
|
else
|
||||||
checkExist ff "${borgConfig[1]}"
|
checkExist ff "${borgConfig[1]}"
|
||||||
checkResult="$?"
|
checkResult="$?"
|
||||||
if [ "$checkResult" = 1 ]; then
|
if [ "$checkResult" = 1 ]; then
|
||||||
# SSH keyfile specified could not be found
|
# SSH keyfile specified could not be found
|
||||||
cleanup
|
|
||||||
exitError+=('211')
|
exitError+=('211')
|
||||||
|
cleanup
|
||||||
quit
|
quit
|
||||||
fi
|
fi
|
||||||
echo -e "${op}${stamp} Borg SSH key... OK${normal}" >> "$logFile"
|
echo -e "${op}${stamp} Borg SSH key... OK${normal}" >> "$logFile"
|
||||||
@ -508,8 +508,8 @@ else
|
|||||||
fi
|
fi
|
||||||
# check: name of borg repo
|
# check: name of borg repo
|
||||||
if [ -z "${borgConfig[2]}" ]; then
|
if [ -z "${borgConfig[2]}" ]; then
|
||||||
cleanup
|
|
||||||
exitError+=('212')
|
exitError+=('212')
|
||||||
|
cleanup
|
||||||
quit
|
quit
|
||||||
else
|
else
|
||||||
export BORG_REPO="{borgConfig[2]}"
|
export BORG_REPO="{borgConfig[2]}"
|
||||||
@ -581,8 +581,8 @@ if [ "$borgResult" -eq 0 ]; then
|
|||||||
elif [ "$borgResult" -eq 1 ]; then
|
elif [ "$borgResult" -eq 1 ]; then
|
||||||
exitWarn+=('borg200')
|
exitWarn+=('borg200')
|
||||||
elif [ "$borgResult" -ge 2 ]; then
|
elif [ "$borgResult" -ge 2 ]; then
|
||||||
cleanup
|
|
||||||
exitError+=('220')
|
exitError+=('220')
|
||||||
|
cleanup
|
||||||
quit
|
quit
|
||||||
else
|
else
|
||||||
exitWarn+=('borg201')
|
exitWarn+=('borg201')
|
||||||
|
Loading…
Reference in New Issue
Block a user