Script to manage Tarsnap backups
Python
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README.markdown
tarsnap_manager.py
tarsnap_manager_test.py

README.markdown

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. If num_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. If num_months monthly backups already exist when a new one is created, the oldest monthly backup is removed.

Command Line Flags

  • key_file: The path to the file containing encryption, authentication, and access keys, generated by tarsnap-keygen. This is passed to tarsnap as --keyfile.
  • cache_dir: The directory that caches information about the stored archives. This is passed to tarsnap as --cachedir.
  • dry_run: If true, then no archives are created or deleted. Instead, the tarsnap 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 by tarsnap-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 is 1 and Sunday is 7.
  • num_days: The number of consecutive daily backups to store. The oldest daily backup is deleted if necessary, unless skip_delete is specified.
  • num_weeks: The number of consecutive weekly backups to store. The oldest weekly backup is deleted if necessary, unless skip_delete is specified.
  • num_months: The number of consecutive monthly backups to store. The oldest monthly backup is deleted if necessary, unless skip_delete is specified.