mongodb: Fix removing old backups

This commit is contained in:
Timo Makinen 2024-10-21 05:17:12 +00:00
parent 5865d0da5c
commit 4f408bac9d

View file

@ -8,9 +8,9 @@ DESTDIR="/srv/backup"
DATE="$(date +%Y-%m-%d)" DATE="$(date +%Y-%m-%d)"
cd "$DESTDIR" cd "$DESTDIR"
find . -xdev -mindepth 2 -maxdepth 2 -type f -mtime +30 \ find . -xdev -mindepth 3 -maxdepth 3 -type f -mtime +30 \
-execdir rm -f -- {} \; -execdir rm -f -- {} \;
find . -xdev -depth -mindepth 1 -maxdepth 1 -type d -empty \ find . -xdev -depth -mindepth 1 -maxdepth 2 -type d -empty \
-execdir rmdir -- {} \; -execdir rmdir -- {} \;
mkdir -m 2750 "$DATE" mkdir -m 2750 "$DATE"