Fix Nextcloud not purging old backups

So THAT'S where all my space was going
This commit is contained in:
Salt 2020-06-07 02:12:54 -05:00
parent 2b52985e7f
commit 252ff7ecf9

View File

@ -35,7 +35,7 @@ if (( currentbackupcount >= retention * 3 )); then
lastbackup="${lastbackup%-*.gz}"
if [ -f "$file" ]; then
log "Removing old backups for: $lastbackup"
for file in "$OUTDIR"/"$lastbackup"*; do
for file in "$lastbackup"*; do
log "Removing old backup part: $file"
rm "$file"
done
@ -44,7 +44,7 @@ fi
# WE MAKE BACKUP NOW SERGEI
if cd "{{ nextcloud_webroot }}"; then
log "Enabling maintenance mode"
sudo -u www-data ./occ maintenance:mode --on
sudo -u www-data ./occ maintenance:mode --on > /dev/null 2>&1
trap 'sudo -u www-data ./occ maintenance:mode --off' EXIT
date="$(date -Iseconds)"
log "Creating data backup"
@ -54,7 +54,7 @@ if cd "{{ nextcloud_webroot }}"; then
log "Creating DB backup"
mysqldump nextcloud --single-transaction | gzip > "$OUTDIR/$date-db.sql.gz"
log "Unsetting maintenance mode"
sudo -u www-data ./occ maintenance:mode --off
sudo -u www-data ./occ maintenance:mode --off > /dev/null 2>&1
trap : EXIT
else
log "Could not change directory: $OUTDIR"