Project

wolfe

0.0
No release in over 3 years
Low commit activity in last 3 years
Often backup files have year, month, date and hour encoded in their filename. Wolfe uses this information to clean up such files and can be configured to keep daily/monthly backups for a certain timespans. It will always keep one backup per year.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
~> 10.0

Runtime

 Project Readme

Codeship Status for lomography/wolfe

Wolfe

Wolfe's purpose is to clean up database (and other) backups that encode year, month, day and hour in their filename. That's also what wolfe will look at when deciding if a file has to be removed or not. Wolfe can be configured to keep daily and monthly backups for a given timespan and will always keep one backup for every year.

Original code was written by @michaelem, tests and gemification by @srecnig. In case you're wondering, the name wolfe is a reference.

Installation

Wolfe can be installed through the usual sources: add it to your application's Gemfile or install manually through gem install.

Usage

Call wolfe from the command line and give a rule file as one single parameter.

wolfe cleanup rules.yml

Or call wolfe from within your project if you've added it to the Gemfile.

Wolfe.run_cleanup "/path/to/rules.yml"

Rules.yml

The rule file contains the information on where backups are stored, how the date metadata is encoded in the filename and how many backups to keep per timespan.

---
backup_name:
  path: /mnt/data/backups/database
  filename: 'backup-database-%{year}-%{month}-%{day}-%{hour}.tar.gz'
  one_per_day_timespan: 15.days
  one_per_month_timespan: 1.year

To configure the timespans we rely on active support's time extensions to Numeric, so something like 1.month, 2.years, etc. will work. No spaces or ruby code please.

Note: The file kept for a timespan is always the file of the last day of the timespan, e.g. the backup file kept for every year will always be the one of 31st, Dec.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/lomography/wolfe. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.