Skip to main content

A wrapper script for Restic backup software that creates and prunes 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:s3.amazonaws.com/bucket_name"
    ]

[environment]
RESTIC_PASSWORD = "CHANGEME"
# or RESTIC_PASSWORD_FILE = "/path/to/file"
# see https://restic.readthedocs.io/en/latest/040_backup.html#environment-variables 
# especially if you need to set environment variables like AWS_ACCESS_KEY_ID and such

[location]
source_directories = [
    "/home",
    "/var"
    ]

# exclude_patterns = []
# exclude_files = []
# https://restic.readthedocs.io/en/stable/040_backup.html#including-and-excluding-files

[retention]
keep-last =  3
keep-hourly =  5
keep-weekly = 10
keep-monthly = 30
# https://restic.readthedocs.io/en/latest/060_forget.html#removing-snapshots-according-to-a-policy

[consistency]
checks = ["check-unused", "read-data"]
# https://restic.readthedocs.io/en/stable/045_working_with_repos.html#checking-a-repo-s-integrity-and-consistency

[metrics.prometheus]
path = "/var/lib/node_exporter/textfile_collector/runrestic.prom"

Installation

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.

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.1.1.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

runrestic-0.1.1-py3-none-any.whl (22.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: runrestic-0.1.1.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.27.0 CPython/3.6.6

File hashes

Hashes for runrestic-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ebc189e4f63cdd79b48284c96c232e06fdbf0f0bca3bfe7c3d0f1ba3554c7319
MD5 79d6fce2391d72ca0137e4082fc6aa3c
BLAKE2b-256 79f8691cc94ce878ef85a0e05cad536ff03d48ca3008efba1f68d23109166d5e

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: runrestic-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 22.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.27.0 CPython/3.6.6

File hashes

Hashes for runrestic-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cf9dc75f8aed5afd0a2695817904477e8dea26a8bb8e2fec2e130cd008ffd7a9
MD5 69925c69880887831e4ce02af8c51069
BLAKE2b-256 1f37195dc6bd7fc2021e71f8ad4d53e0ac613c0a0270f7edc1227ffb371cac5b

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