A wrapper script for Restic backup software that inits, creates, prunes and checks backups
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.
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
Installing runrestic and restic
To install runrestic, run the following command to download and install it:
sudo pip3 install --upgrade runrestic
You can either manually download and install Restic or you can just run
runrestic and it'll try to download it for you.
Initializing and running
Once you have
runrestic ready, you should put a config file in on of the scanned locations, namely:
runrestic init # to initialize all the repos in `repositories` runrestic # without actions will do: runrestic backup prune check # or runrestic [action]
Certain `restic` flags like `--dry-run/-n` are built into `runrestic` as well and will be passed to restic where applicable.
If, however, you need to pass along arbitrary other flags you can now add them to the end of your
runrestic call like so:
runrestic backup -- --one-file-system
To use the options defined in
restic (e.g. for a backup restore), you can use the
If you are using multiple repositories or configurations, you can select one now.
Prometheus / Grafana metrics
@d-matt created a nice dashboard for Grafana here: https://grafana.com/grafana/dashboards/11064/revisions
systemd timer or cron
If you want to run runrestic automatically, say once a day, the you can configure a job runner to invoke it periodically.
sudo mv runrestic.service runrestic.timer /etc/systemd/system/ sudo systemctl enable runrestic.timer sudo systemctl start runrestic.timer
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
- support JSON config files.
- fix issue where "check" does not count towards overall "errors"-metric
v0.5! Expect breaking changes.
- metrics output is a bit different
- see new
@tabic wrote an ansible role, you can find it here: https://github.com/outwire/ansible-role-restic . (I have neither checked nor tested it.)
This project is managed with poetry
Install it if not already present:
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python # or pip install --user poetry
poetry run pytest
This project was initially based on borgmatic but has since evolved into something else.
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size runrestic-0.5.23-py3-none-any.whl (17.5 kB)||File type Wheel||Python version py3||Upload date||Hashes View|
|Filename, size runrestic-0.5.23.tar.gz (16.6 kB)||File type Source||Python version None||Upload date||Hashes View|
Hashes for runrestic-0.5.23-py3-none-any.whl