Tarsnap Manager is a Python script to manage backups of data using Tarsnap, and is intended to be run as a daily cron job. The directories to backup and the number of daily, weekly, and monthly backups to keep are configured by the command line:
- If
num_days
daily backups already exist when a new one is created, the oldest daily backup is removed. - Weekly backups happen on every weekday specified by
weekday
. Ifnum_weeks
weekly backups already exist when a new one is created, the oldest weekly backup is removed. - Likewise, monthly backups happen on the first weekday of the month specified by
weekday
. Ifnum_months
monthly backups already exist when a new one is created, the oldest monthly backup is removed.
key_file
: The path to the file containing encryption, authentication, and access keys, generated bytarsnap-keygen
. This is passed totarsnap
as--keyfile
.cache_dir
: The directory that caches information about the stored archives. This is passed totarsnap
as--cachedir
.dry_run
: Iftrue
, then no archives are created or deleted. Instead, thetarsnap
commands that would have been run are simply printed.skip_delete
: Skips deleting the oldest daily, weekly, or monthy archive. Use if the specified key file was created bytarsnap-keymgmt
to not allow deletion.archive_name
: The prefix for each archive name.weekday
: The day on which to perform weekly and monthly backups, where Monday is1
and Sunday is7
.num_days
: The number of consecutive daily backups to store. The oldest daily backup is deleted if necessary, unlessskip_delete
is specified.num_weeks
: The number of consecutive weekly backups to store. The oldest weekly backup is deleted if necessary, unlessskip_delete
is specified.num_months
: The number of consecutive monthly backups to store. The oldest monthly backup is deleted if necessary, unlessskip_delete
is specified.