Skip to content

Commit

Permalink
Fix default cleanup command
Browse files Browse the repository at this point in the history
This patch ensures that the default cleanup command will not try to
delete the backup directory itself. It will now, however, delete files
recursively, removing old directories, even if they contain newer
contents.
  • Loading branch information
lkiesow committed Dec 8, 2023
1 parent 915465b commit 8d4f046
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,8 @@ backup_group: "{{ backup_user }}"
# FILENAME="{{ backup_mountpoint }}/$(date '+%Y%m%d-%H%M%S').sql.gz"
# mysqldump -u root --no-data dbname | gzip > "${FILENAME}"

backup_cleanup: |
find "{{ backup_mountpoint }}" -mtime "+{{ backup_keep_days }}" -delete
backup_cleanup: >-
find "{{ backup_mountpoint }}"
-mindepth 2
-mtime "+{{ backup_keep_days }}"
-exec rm -rfv '{}' \;

0 comments on commit 8d4f046

Please sign in to comment.