diff --git a/.backup_exclude b/.backup_exclude new file mode 100644 index 0000000..c591cbd --- /dev/null +++ b/.backup_exclude @@ -0,0 +1,10 @@ +/.snapshots/ +/opt +/root/.cache/ +/usr/share/**/*.html +/usr/share/help/ +/usr/share/licenses/ +/usr/share/man/ +/usr/src/ +/var/cache/ +/var/log/ diff --git a/README.md b/README.md index 24a70b8..d4931f4 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ First, see this official Backblaze [tutorial](https://help.backblaze.com/hc/en-u ## Automatic scheduled backups Unfortunately restic does not come per-configured with a way to run automated backups, say every day. However it's possible to set this up yourself using. This example also features email notifications when a backup fails to complete. +### 1. Put this file in `/etc/restic/`: * `b2_env.sh`: Fill this file out with your B2 bucket settings etc. The reason for putting these in a separeate file is that it can be used also for you to simply source, when you want to issue some restic commands. For example: ```bash @@ -17,17 +18,23 @@ $ restic snapshots # You don't have to supply all paramters like --repo, as t ```` * `b2_pw.txt`: Put your b2 password in this file. +### 2. Put these files in `/usr/local/sbin`: * `restic_backup.sh`: A script that defines how to run the backup. Edit this file to respect your needs in terms of backup which paths to backup, retention (number of bakcups to save), etc. * `systemd-email`: Sends email using sendmail. You must set up your computer so it can send mail, for example using [postfix and Gmail](https://easyengine.io/tutorials/linux/ubuntu-postfix-gmail-smtp/). This script also features time-out for not spamming Gmail servers. +### 3. Put these files in `/etc/systemd/system/`: * `restic-backup.service`: A service that calls the script above. * `restic-backup.timer`: A timer (systemd's cronjobs) that starts the backup every day. * `status-email-user@.service`: A service that can notify you via email when a systemd service fails. Edit the target email address in this file. +### 4. +Finally, put the file `.backup_exclude` in `/`, and add file patterns you want to exclude from your backups. + +### 5. Now simply enable the timer with: ```bash $ systemctl enable restic-backup.timer