Skip to main content

A wrapper script for Restic backup software that inits, creates, prunes and checks backups

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

runrestic-0.2.4.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

runrestic-0.2.4-py3-none-any.whl (27.1 kB view details)

Uploaded Python 3

File details

Details for the file runrestic-0.2.4.tar.gz.

File metadata

  • Download URL: runrestic-0.2.4.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for runrestic-0.2.4.tar.gz
Algorithm Hash digest
SHA256 3af7d67c015dfd8805418124d8a6d51b6e8fe552a00b1bf2cecad1bc20080667
MD5 67aae98ef6f4ce6ab0085ab285a47bd3
BLAKE2b-256 6f5d5887dc4294f36269315a59ecc3935857b1374a5b74faf290a1fb71c34a31

See more details on using hashes here.

Provenance

File details

Details for the file runrestic-0.2.4-py3-none-any.whl.

File metadata

  • Download URL: runrestic-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 27.1 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for runrestic-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 8f475e1d60c8eff6a6ee6486f88185150fb74b08630b9c84fc38a09a50d8afe9
MD5 8308c3a4dae1d8acf7d40294e7f6229e
BLAKE2b-256 81f09a17b9c7732a409ef4a2a383fae031b0f98ae0f1cb0542e9789bb678cc68

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page