made everything a little bit easier to configure

This commit is contained in:
Tobias Trabelsi 2019-01-07 21:56:37 +01:00
parent 8aaaa8fa7c
commit 579ba632d6
6 changed files with 19 additions and 21 deletions

8
etc/restic/env.sh Normal file
View File

@ -0,0 +1,8 @@
#!/bin/bash
export RESTIC_PASSWORD_FILE="/etc/restic/pw.txt"
export RESTIC_REPOSITORY="sftp:lerentis@192.168.0.211:/srv/dev-disk-by-id-md-name-asgard-Data/Backup/Laptop/Huginn"
# What to backup, and what to not
BACKUP_PATHS="/home/lerentis/"
BACKUP_EXCLUDES="--exclude-file ${BACKUP_PATHS}.backup_exclude"

View File

@ -1,10 +1,12 @@
[Unit]
Description=Backup with restic to Backblaze B2
Description=Backup with restic
OnFailure=status-email-user@%n.service
[Service]
Type=simple
Nice=10
User=lerentis
ExecStart=/usr/local/sbin/restic_backup.sh
# $HOME or $XDG_CACHE_HOME must be set for restic to find /root/.cache/restic/
Environment="HOME=/home/lerentis/"
Environment="HOME=/home/lerentis/"
Environment=SSH_AUTH_SOCK=%t/ssh-agent.socket

View File

@ -1,9 +1,12 @@
[Unit]
Description=Check restic backup Backblaze B2 for errors
Description=Check restic backup for errors
OnFailure=status-email-user@%n.service
Conflicts=restic.service
[Service]
Type=simple
User=lerentis
Nice=10
ExecStart=/usr/local/sbin/restic_check.sh
Environment="HOME=/home/lerentis/"
Environment=SSH_AUTH_SOCK=%t/ssh-agent.socket

View File

@ -1,8 +1,5 @@
# Source: https://serverfault.com/questions/876233/how-to-send-an-email-if-a-systemd-service-is-restarted
# Source: https://wiki.archlinux.org/index.php/Systemd/Timers#MAILTO
[Unit]
Description=Send status email for %i to user
Description=Send status popup for %i to user
[Service]
Type=oneshot

View File

@ -5,8 +5,7 @@
# Exit on failure, pipe failure
set -e -o pipefail
export RESTIC_PASSWORD_FILE="/etc/restic/pw.txt"
export RESTIC_REPOSITORY="sftp:lerentis@asgard.lan:/srv/dev-disk-by-id-md-name-asgard-Data/Backup/Laptop/Huginn"
source /etc/restic/env.sh
# Clean up lock if we are killed.
# If killed by systemd, like $(systemctl stop restic), then it kills the whole cgroup and all it's subprocesses.
@ -23,10 +22,6 @@ RETENTION_DAYS=14
RETENTION_WEEKS=16
RETENTION_MONTHS=18
RETENTION_YEARS=3
# What to backup, and what to not
BACKUP_PATHS="/home/lerentis/"
BACKUP_EXCLUDES="--exclude-file /home/lerentis/.backup_exclude"
BACKUP_TAG=systemd.timer

View File

@ -5,8 +5,7 @@
# Exit on failure, pipe failure
set -e -o pipefail
export RESTIC_PASSWORD_FILE="/etc/restic/pw.txt"
export RESTIC_REPOSITORY="sftp:lerentis@asgard.lan:/srv/dev-disk-by-id-md-name-asgard-Data/Backup/Laptop/Huginn"
source /etc/restic/env.sh
# Clean up lock if we are killed.
# If killed by systemd, like $(systemctl stop restic), then it kills the whole cgroup and all it's subprocesses.
@ -18,12 +17,6 @@ exit_hook() {
}
trap exit_hook INT TERM
#source /etc/restic/b2_env.sh
# How many network connections to set up to B2. Default is 5.
B2_CONNECTIONS=50
# Remove locks from other stale processes to keep the automated backup running.
# NOTE nope, dont' unlock liek restic_backup.sh. restic_backup.sh should take preceedance over this script.
#restic unlock &