cronicle
/ˈkɹɒnɪkəl/ :
n. a factual written account of important events in the order of their occurrence
n. software to archive the N most recent backups of a file in a folder named after the job frequency. Recommended use is to trigger it via a cron job.
Originally, cronicle has been conceived as a solution to this particular serverfault question : How to keep: daily backups for a week, weekly for a month, monthly for a year, and yearly after that.
Features
simplicity: add one line to your crontab and you’re done
files rotation: keep the N most recent versions of a file
space efficient: use symlinks in target directories to store a single occurence of each backup instead of performing copies. When removing a link, remove the underlying file if no other link point to it.
Usage
In order to manage a file backups with cronicle, you must have a section in the config.yaml that matches the backups names. Under it you can then define values (number of archives to keep) for the five kinds of periodic archives : hourly, daily, weekly, monthly, yearly.
Or define a custom periodicity using the pipe syntax eg bimonthly|60: 3 to keep archives every two months over the last six months.
Example
If you have dumps of a database in a ~/dumps directory named like mydb-20170101.dump, mydb-20170102.dump, and want to keep each dump for 7 days plus go back up to two months ; a working ${HOME}/.config/cronicle/config.yaml content would be :
/home/johndoe/dumps/mydb-*.dump:
daily: 7
monthly: 2
Next cronicle call will result in the creation of folders DAILY and MONTHLY in /home/johndoe/dumps/, each folder containing symlinks to the .dump files.
Installation
cronicle is written for Python 2.7 and Python 3, is tested on Linux and Mac OS X.
Install with pip via pip install git+https://github.com/Kraymer/cronicle.git command.
cron triggering
For a no-brainer use, I recommend to run cronicle via cron, just after the command in charge of performing the backup. A crontab example :
@daily pg_dump -Fc mydb > /home/johndoe/dumps/mydb-`date +%F`.dump @daily cronicle -r /home/johndoe/dumps/mydb-`date +%F`.dump
If used with the config.yaml as defined in the previous section, this daily call to cronicle guarantees that you will keep at most 9 database dumps (7 latest daily + 2 monthly).
Metadata
Release files for cronicle 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cronicle-0.4.0.tar.gz | 9.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cronicle-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.5 kB
Release files / cronicle-0.4.0.tar.gz
| Download URL | cronicle-0.4.0.tar.gz |
|---|---|
| Size | 9.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
26493e5b8ce0e7d8f393db1d010fca3e70ea0f395e46ff777a99b42e911903b0
|
|
BLAKE2b-256 checksum How to use checksums |
519c87a117ff025e790193a4bfb51214a904238ba2be0693ddc11565f2a2ecc1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1
|
Release files / cronicle-0.4.0-py3-none-any.whl
| Download URL | cronicle-0.4.0-py3-none-any.whl |
|---|---|
| Size | 7.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0d736f489ace8776ef8c2fc1d9420f6c807178876d0df09f4d8a492ae56cdd01
|
|
BLAKE2b-256 checksum How to use checksums |
9e2da97568453bed38d02ed32485e523677d0a4b978f0b0e10dde4b6e0c55e21
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.1
|