Skip to content

A script to simplify backups, restores, snapshot deletes, and data validation using Restic.

Notifications You must be signed in to change notification settings

chriskomus/restic-backup-helper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Restic Helper

A script to simplify backups, restores, snapshot deletes, and data validation using Restic.

Setup

Installation and Configs

Install and set up Restic.

Optional: Configure Restic to store backup snapshots in AWS S3.

Edit config.sh to set the location of the Restic password, AWS/cloud config, backup, and restore directories.

Create a Restic password file containing only the password.

Create a Restic config file with the following:

export AWS_ACCESS_KEY_ID=*****
export AWS_SECRET_ACCESS_KEY=*****
export RESTIC_REPOSITORY=s3:https://s3.us-east-1.amazonaws.com/bucket-name
export DB_NAMES=(dbname-a dbname-b dbname-c)
[mysqldump]
user=username
password="usedoublequotes"

Cron Job Setup

To set up a Cron Job:

sudo crontab -e

Append the following line (this will back up every day at 5am):

0 5 * * * /home/username/git/simple-restic-backups/restic.sh --backup

Usage

This script enables you to:

Backup a directory Restore a specific snapshot Delete a specific snapshot List all files in a snapshot List all snapshots Verify the integrity of backups Usage Examples

Backup

./restic.sh --backup

List all snapshots

./restic.sh --snapshots

List all files in a snapshot

./restic.sh --files --id <snapshot_id>

Delete a snapshot

./restic.sh --delete --id <snapshot_id>

Restore latest snapshot

./restic.sh --restore

Restore a specific snapshot

./restic.sh --restore --id <snapshot_id>

Notes

Ensure proper permissions or run as root for backup operations outside the user's home directory. Use only one of the following flags at a time: --backup, --delete, --restore, or --files. For --restore, if no snapshot ID is provided, it restores the latest backup. For detailed information on flags and usage, run:

./restic.sh --help

Note: This script assumes familiarity with Restic and its usage.

Remember to edit the script's config.sh file with your specific configurations before use.

About

A script to simplify backups, restores, snapshot deletes, and data validation using Restic.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages