made everything a little bit easier to configure
This commit is contained in:
parent
8aaaa8fa7c
commit
579ba632d6
8
etc/restic/env.sh
Normal file
8
etc/restic/env.sh
Normal 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"
|
@ -1,10 +1,12 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=Backup with restic to Backblaze B2
|
Description=Backup with restic
|
||||||
OnFailure=status-email-user@%n.service
|
OnFailure=status-email-user@%n.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
Nice=10
|
Nice=10
|
||||||
|
User=lerentis
|
||||||
ExecStart=/usr/local/sbin/restic_backup.sh
|
ExecStart=/usr/local/sbin/restic_backup.sh
|
||||||
# $HOME or $XDG_CACHE_HOME must be set for restic to find /root/.cache/restic/
|
# $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
|
@ -1,9 +1,12 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=Check restic backup Backblaze B2 for errors
|
Description=Check restic backup for errors
|
||||||
OnFailure=status-email-user@%n.service
|
OnFailure=status-email-user@%n.service
|
||||||
Conflicts=restic.service
|
Conflicts=restic.service
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
|
User=lerentis
|
||||||
Nice=10
|
Nice=10
|
||||||
ExecStart=/usr/local/sbin/restic_check.sh
|
ExecStart=/usr/local/sbin/restic_check.sh
|
||||||
|
Environment="HOME=/home/lerentis/"
|
||||||
|
Environment=SSH_AUTH_SOCK=%t/ssh-agent.socket
|
@ -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]
|
[Unit]
|
||||||
Description=Send status email for %i to user
|
Description=Send status popup for %i to user
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
|
@ -5,8 +5,7 @@
|
|||||||
# Exit on failure, pipe failure
|
# Exit on failure, pipe failure
|
||||||
set -e -o pipefail
|
set -e -o pipefail
|
||||||
|
|
||||||
export RESTIC_PASSWORD_FILE="/etc/restic/pw.txt"
|
source /etc/restic/env.sh
|
||||||
export RESTIC_REPOSITORY="sftp:lerentis@asgard.lan:/srv/dev-disk-by-id-md-name-asgard-Data/Backup/Laptop/Huginn"
|
|
||||||
|
|
||||||
# Clean up lock if we are killed.
|
# 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.
|
# 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_WEEKS=16
|
||||||
RETENTION_MONTHS=18
|
RETENTION_MONTHS=18
|
||||||
RETENTION_YEARS=3
|
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
|
BACKUP_TAG=systemd.timer
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,8 +5,7 @@
|
|||||||
# Exit on failure, pipe failure
|
# Exit on failure, pipe failure
|
||||||
set -e -o pipefail
|
set -e -o pipefail
|
||||||
|
|
||||||
export RESTIC_PASSWORD_FILE="/etc/restic/pw.txt"
|
source /etc/restic/env.sh
|
||||||
export RESTIC_REPOSITORY="sftp:lerentis@asgard.lan:/srv/dev-disk-by-id-md-name-asgard-Data/Backup/Laptop/Huginn"
|
|
||||||
|
|
||||||
# Clean up lock if we are killed.
|
# 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.
|
# 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
|
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.
|
# 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.
|
# NOTE nope, dont' unlock liek restic_backup.sh. restic_backup.sh should take preceedance over this script.
|
||||||
#restic unlock &
|
#restic unlock &
|
||||||
|
Loading…
Reference in New Issue
Block a user