Selectively purge daily full backups
Project description
Lists files in that should be purged in a backup strategy where daily backups are kept for DAYS days, monthly backups for MONTHS months and yearly backups for YEARS years. Monthly and yearly backups are always the oldest possible daily backup (e.g. first of month and first of year that is available).
Files are expected to have their date embedded as YYYY-MM-DD somewhere in the filename, e.g. homedir-2013-03-31.tgz
For monthly and yearly backups, the first day available will be kept (e.g. January 1st for yearly, but if that is not available, January 2nd will be kept, etc..).
This program can be used together with xargs(1) from GNU findutils:
backuppurge --print0 /var/backups/ | xargs -r -0 rm
Only files directly in the specified DIRECTORY will be searched (in the above example, /var/backups/homedir-2013-03-31.tgz will be considered, but not /var/backups/etc/etc-2013-03-31.tgz). This prevents accidental deletion of files. If –include-directories (-D) is used, directories directly below the path will be included in the search (e.g. the directory /var/backups/etc-2015-07-24/ will be included in the purge search).
This script assumes daily backups are FULL backups, not incremental. For example, a full daily backup of your /etc can be created by adding (crontab -e) a command like the following to your crontab(5) file:
tar czf /var/backups/etc/etc-$(date +%F).tgz /etc
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file backuppurge-1.0.6.tar.gz
.
File metadata
- Download URL: backuppurge-1.0.6.tar.gz
- Upload date:
- Size: 9.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9a98347a87133c87ce93e4438a9b13beeefa8f0ee819c77948dff6010af03f06 |
|
MD5 | 0c3f57052ab9b6f1fa46a4098e2c5dee |
|
BLAKE2b-256 | b42c9b66772ab3871eeb18491d8d70ea1edf083c54f856bcd23503eadbf59d0d |
File details
Details for the file backuppurge-1.0.6-py3-none-any.whl
.
File metadata
- Download URL: backuppurge-1.0.6-py3-none-any.whl
- Upload date:
- Size: 10.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 746db0ee153dfd93610bfd49ce0f28447e9c82fdf2c0df8d6b2a9357865f970f |
|
MD5 | 6ca46869cc515f9842ed1a7aaa668124 |
|
BLAKE2b-256 | 48523c6b7ba4f20066d04aa54ccee0c2eaabd19f67562652d2b79e016d56d39f |