From 252ff7ecf9ed2b3f85e8c9b6980b1b19be3a5550 Mon Sep 17 00:00:00 2001 From: Salt Date: Sun, 7 Jun 2020 02:12:54 -0500 Subject: [PATCH] Fix Nextcloud not purging old backups So THAT'S where all my space was going --- roles/nextcloud/templates/backup.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/nextcloud/templates/backup.sh b/roles/nextcloud/templates/backup.sh index 177a503..6f81399 100644 --- a/roles/nextcloud/templates/backup.sh +++ b/roles/nextcloud/templates/backup.sh @@ -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"