Added sample .backup_exclude file

This commit is contained in:
Erik Westrup
2018-06-02 00:28:04 +02:00
parent d90a087537
commit b2169c0460
2 changed files with 17 additions and 0 deletions

10
.backup_exclude Normal file
View File

@@ -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/

View File

@@ -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