delete temporary directories before starting host backup

This commit is contained in:
2023-12-13 16:47:52 +01:00
parent 8faea3fef1
commit 2c643c73c6

View File

@@ -46,6 +46,7 @@ function logecho {
echo "$(pdate) $*" >> "$LOG"
}
# Loop over all hosts
while read -r line; do
# if line is a comment or blank, go to next line
if echo "$line" | grep -qE "^\s*(#|$)"; then continue; fi
@@ -80,6 +81,9 @@ while read -r line; do
logecho "${RHOST}: Starting backups"
logecho "${RHOST}: Deleting host's temporary directories in ${TEMPDIR}"
rm -rf "${TEMPDIR:?}/${RHOST:?}/*"
NORDIR=$(echo "$ALLRDIR" | grep -o "|" | wc -l || true)
NORDIR=$(($NORDIR + 1))