Helper scripts to use restic more easily on Linux x86, x64 and ARM (such as Truenas Scale or generic Debian/Ubuntu/Arch etc.). Scripts might work on BSD if you try that by setting OS to BSD.
Simple steps:
- Install
git
- Run
git clone https://github.com/christiaangoossens/restic-backup-scripts.git
- Go to the
restic-backup-scripts
directory usingcd restic-backup-scripts
- Copy
.env.example
to.env
and fill in your repository path and password for the repository. Alternatively, you can also setRESTIC_PASSWORD_FILE
in the .env file to use password files instead (orRESTIC_PASSWORD_COMMAND
). Any restic env vars are supported. - Call
./restic
with your arguments to use restic directly with the env. For example./restic version
should give you the current version. - Profit!
The scripts also support passing either -e=PATH
or --env-file=PATH
as commands to set the env var to a different path.
Initializes the repository that you configured in .env.
Automatically runs the backup and cleanup as configured. Use .env file to configure paths to be included and retention policy.
Automatically restores the last snapshot to the configured directories. Use .env file to configure paths to be included/restored.
Automatically runs the backup retention policy as configured. Use .env file to configure paths to be included and retention policy.
Gives a file tree of the latest snapshot, only showing files and their sizes
Update the scripts to the latest version.
Manually prune the repository if you have BACKUP_PRUNE
set to false
. Make this a regular cron task, probably monthly.
View existing snapshots on your repository.
Update restic binary automatically in /tmp/restic
.
Show statistics on your repository, such as total size and file count.
You might have append-only backups running from one machine using these scripts, while having the ./cleanup
command run from another machine. For this, configure all backup retentions to 0
on the sending
machine and run ./run-backup
and configure the correct retentions on the admin
machine and run ./cleanup
there. Please review the safety considerations documentation for more info.