todiadiyatmo/bash-backup-rotation-script

Doesn't delete old files

Opened this issue · 3 comments

This section of code is incorrect

delete old files

find $TMP_DIR/ -maxdepth 1 -mtime +$RETENTION_DAY_LOOKUP -name "$BACKUP_TYPE" -exec rm -rv {} ;
find $TMP_DIR/.ftp_cache/ -maxdepth 1 -mtime +$RETENTION_DAY_LOOKUP -name "$BACKUP_TYPE" -exec rm -rv {} ;

This means that old backups don't ever get deleted and hard drive will eventually fill. (Remember, last week's backups were stored at $CURRENT_DIR, not $TMP_DIR)

While the find commands here don't look at the right location, the backup was not stored in $CURRENT_DIR.

Section #[Pre]form Files Backup has this:
cd $TARGET_DIR
tar -chJf $TMP_DIR/backup.incoming/$backup_filename $BACKUP_DIR

I'm using xz instead but either way there's no $CURRENT_DIR there.

@odingalt and @clickwir okay thanks for the info, let me investigate this