Updated all calls to quit to use new exitError counter
This commit is contained in:
parent
01f4a3dc0c
commit
7d52face6d
27
backup.sh
27
backup.sh
@ -126,7 +126,8 @@ function cleanup {
|
|||||||
echo -e "${info}${stamp} -- [INFO] NextCloud now in regular" \
|
echo -e "${info}${stamp} -- [INFO] NextCloud now in regular" \
|
||||||
"operating mode --${normal}" >> "$logFile"
|
"operating mode --${normal}" >> "$logFile"
|
||||||
else
|
else
|
||||||
quit 101
|
exitError+=('101')
|
||||||
|
quit
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -435,7 +436,8 @@ if [ "$maintResult" = "0" ]; then
|
|||||||
"${normal}" >> "$logFile"
|
"${normal}" >> "$logFile"
|
||||||
else
|
else
|
||||||
cleanup
|
cleanup
|
||||||
quit 100
|
exitError+=('100')
|
||||||
|
quit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
@ -455,7 +457,8 @@ if [ "$dumpResult" = "0" ]; then
|
|||||||
>> "$logFile"
|
>> "$logFile"
|
||||||
else
|
else
|
||||||
cleanup
|
cleanup
|
||||||
quit 200;
|
exitError+=('200')
|
||||||
|
quit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
### Call borgbackup to copy actual files
|
### Call borgbackup to copy actual files
|
||||||
@ -471,7 +474,8 @@ mapfile -t borgConfig < "$borgDetails"
|
|||||||
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
|
cleanup
|
||||||
quit 210
|
exitError+=('210')
|
||||||
|
quit
|
||||||
else
|
else
|
||||||
# verify the path actually exists
|
# verify the path actually exists
|
||||||
checkExist fd "${borgConfig[0]}"
|
checkExist fd "${borgConfig[0]}"
|
||||||
@ -479,7 +483,8 @@ else
|
|||||||
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
|
cleanup
|
||||||
quit 210
|
exitError+=('210')
|
||||||
|
quit
|
||||||
fi
|
fi
|
||||||
echo -e "${op}${stamp} Borg base dir... OK${normal}" >> "$logFile"
|
echo -e "${op}${stamp} Borg base dir... OK${normal}" >> "$logFile"
|
||||||
export BORG_BASE_DIR="${borgConfig[0]}"
|
export BORG_BASE_DIR="${borgConfig[0]}"
|
||||||
@ -487,14 +492,16 @@ fi
|
|||||||
# check: path to SSH keyfile
|
# check: path to SSH keyfile
|
||||||
if [ -z "${borgConfig[1]}" ]; then
|
if [ -z "${borgConfig[1]}" ]; then
|
||||||
cleanup
|
cleanup
|
||||||
quit 211
|
exitError+=('211')
|
||||||
|
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
|
cleanup
|
||||||
quit 211
|
exitError+=('211')
|
||||||
|
quit
|
||||||
fi
|
fi
|
||||||
echo -e "${op}${stamp} Borg SSH key... OK${normal}" >> "$logFile"
|
echo -e "${op}${stamp} Borg SSH key... OK${normal}" >> "$logFile"
|
||||||
export BORG_RSH="ssh -i ${borgConfig[1]}"
|
export BORG_RSH="ssh -i ${borgConfig[1]}"
|
||||||
@ -502,7 +509,8 @@ fi
|
|||||||
# check: name of borg repo
|
# check: name of borg repo
|
||||||
if [ -z "${borgConfig[2]}" ]; then
|
if [ -z "${borgConfig[2]}" ]; then
|
||||||
cleanup
|
cleanup
|
||||||
quit 212
|
exitError+=('212')
|
||||||
|
quit
|
||||||
else
|
else
|
||||||
export BORG_REPO="{borgConfig[2]}"
|
export BORG_REPO="{borgConfig[2]}"
|
||||||
fi
|
fi
|
||||||
@ -574,7 +582,8 @@ elif [ "$borgResult" -eq 1 ]; then
|
|||||||
exitWarn+=('borg200')
|
exitWarn+=('borg200')
|
||||||
elif [ "$borgResult" -ge 2 ]; then
|
elif [ "$borgResult" -ge 2 ]; then
|
||||||
cleanup
|
cleanup
|
||||||
quit 220
|
exitError+=('220')
|
||||||
|
quit
|
||||||
else
|
else
|
||||||
exitWarn+=('borg201')
|
exitWarn+=('borg201')
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user