TrashMan
Removes outdated periodic backup files from your cloud storage bucket.
Install
Into Gemfile from rubygems.org:
gem install trashman
Note
This gem assumes your filenames include a date and time e.g. backup.2015-07-07T10-32-01.tar.gz.
backup.$(date +'\%Y-\%m-\%dT\%H-\%M-\%S').tar.gz
Please use the --dry-run
option to test your configuration before using trashman.
Usage
trashman is best used as a cronjob. It assumes you have a cloud storage bucket where you store periodic backups with conventional filenames including date and time.
To destroy outdated backups:
trashman prune --provider <FOG PROVIDER> --keep <NUMBER OF FILES TO KEEP> --container <CONTAINER/BUCKET> --credentials username:<USERNAME> password:<PASSWORD>
trashman prune --provider rackspace --keep 100 --container "Test Container" --credentials rackspace_api_key:abc123 rackspace_username:example rackspace_region:ord
trashman help prune
Usage:
trashman prune --credentials=key:value -P, --provider=PROVIDER -c, --container=CONTAINER
Options:
-P, --provider=PROVIDER # A valid fog provider e.g. rackspace, aws, etc.
-c, --container=CONTAINER # Container or bucket on fog provider.
-k, [--keep=N] # Number of files to keep.
# Default: 100
--credentials=key:value # Credentials for your fog provider (depends on fog provider).
[--dry-run], [--no-dry-run] # As normal, but it does not destroy old backups.
[--pattern=PATTERN] # A regular expression to only consider
matching filenames for pruning.
Contributors
Many thanks to:
How to contribute
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Write your tests and check everything passes
- Push to the branch (
git push origin my-new-feature
) - Create new Pull Request (into the master branch)
License
Please refer to LICENSE.md.