1
0
Fork 0
forked from infra/ansible

Rename retention script per feedback

Signed-off-by: Michael Winters <fedora@mwinters.net>
This commit is contained in:
Michael Winters 2026-04-02 09:27:59 -05:00 committed by Kevin Fenzi
commit 2a941c4482
4 changed files with 10 additions and 6 deletions

View file

@ -7,4 +7,4 @@ export ANSIBLE_HOST_KEY_CHECKING=False
/srv/web/infra/ansible/scripts/public-db-copy >& /dev/null
# Delete old datanommer-incremental backups
/srv/web/infra/ansible/scripts/iso-file-retention /srv/web/infra/db-dumps/datanommer-incremental >& /dev/null
/srv/web/infra/ansible/scripts/file-retention-iso-date /srv/web/infra/db-dumps/datanommer-incremental >& /dev/null

View file

@ -143,5 +143,5 @@ echo
echo "$(date -Iseconds): export done!"
echo "Running retention script for '$DESTDIR'..."
/usr/local/bin/iso-file-retention "$DESTDIR"
/usr/local/bin/file-retention-iso-date "$DESTDIR"
echo

View file

@ -15,8 +15,8 @@
- postgresql
- name: Copy iso-file-retention script
ansible.builtin.copy: src=scripts/iso-file-retention dest=/usr/local/bin/iso-file-retention mode=0755
- name: Copy file-retention-iso-date script
ansible.builtin.copy: src=scripts/file-retention-iso-date dest=/usr/local/bin/file-retention-iso-date mode=0755
tags:
- datanommer
- postgresql

View file

@ -1,8 +1,12 @@
#!/bin/bash
# vim: ts=4:sw=4:expandtab:tw=100
# Deletes files prefixed with ISO dates (YYYY-MM-DD-) older than RETENTION_DAYS days,
# but always retains the most-recent MIN_KEEP files even if they're "old".
# This script manages a set of backup files which are prefixed with ISO dates (YYYY-MM-DD).
# - As new files come in, we want to delete the old ones.
# - RETENTION_DAYS decides how old is "old".
# - But if no new files come in (e.g. the backup process is broken), we don't want to
# end up deleting _all_ the files, just because they're old.
# - MIN_KEEP decides how many files to keep.
#
# Usage: ./retain.sh --dry-run <directory>