Overview
runrestic is a simple Python wrapper script for the Restic backup software that initiates a backup, prunes any old backups according to a retention policy, and validates backups for consistency. The script supports specifying your settings in a declarative configuration file rather than having to put them all on the command-line, and handles common errors.
Here's an example config file:
repositories = [
"/tmp/restic-repo",
"sftp:user@host:/srv/restic-repo",
"s3:s3.amazonaws.com/bucket_name"
]
[environment]
RESTIC_PASSWORD = "CHANGEME"
[backup]
sources = [
"/home",
"/var"
]
[prune]
keep-last = 3
keep-hourly = 5
For a more comprehensive example see the example.toml or check the schema.json
Getting started
To get up and running, first install Restic.
To install runrestic, run the following command to download and install it:
sudo pip3 install --upgrade runrestic
Note that your pip binary may have a different name than pip3. Make sure
you're using Python 3, as runrestic does not support Python 2.
Once you have restic and runrestic ready, you should put a config file in on of the scanned locations, namely:
- /etc/runrestic.toml
- /etc/runrestic/example.toml
- ~/.config/runrestic/example.toml
Afterwards, run
runrestic init # to initialize all the repos in `repositories`
runrestic # without actions will do: runrestic backup prune check
# or
runrestic [action]
Autopilot
If you want to run runrestic automatically, say once a day, the you can configure a job runner to invoke it periodically.
cron
If you're using cron, download the sample cron file. Then, from the directory where you downloaded it:
sudo mv runrestic /etc/cron.d/runrestic
sudo chmod +x /etc/cron.d/runrestic
systemd
If you're using systemd instead of cron to run jobs, download the sample systemd service file and the sample systemd timer file. Then, from the directory where you downloaded them:
sudo mv runrestic.service runrestic.timer /etc/systemd/system/
sudo systemctl enable runrestic.timer
sudo systemctl start runrestic.timer
Thanks
Much of this project is copy and paste from borgmatic.
Release files for runrestic 0.2.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| runrestic-0.2.5.tar.gz | 11.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| runrestic-0.2.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 38.3 kB
Release files / runrestic-0.2.5.tar.gz
| Download URL | runrestic-0.2.5.tar.gz |
|---|---|
| Size | 11.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7a40c93a57b94da40b7e37abed0a9bcf58ad32128f211e4c896d377376566877
|
|
BLAKE2b-256 checksum How to use checksums |
ea34f1ebfc53e9a41b3ca31332215848e6949520614fee5c647bc6146a8b1496
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6
|
Release files / runrestic-0.2.5-py3-none-any.whl
| Download URL | runrestic-0.2.5-py3-none-any.whl |
|---|---|
| Size | 27.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ced94a0964e6b70e8a6ddfdac62e9e581cbc2d9a7b95863f6262ac94863cccf1
|
|
BLAKE2b-256 checksum How to use checksums |
71f3ff6535c9153d9a04ed386a38a9e7d83f4994ed5548b566770b26e9e69db9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6
|