mirror of https://github.com/erikw/restic-systemd-automatic-backup without B2
This commit is contained in:
8
etc/cron.d/restic
Normal file
8
etc/cron.d/restic
Normal file
@ -0,0 +1,8 @@
|
||||
SHELL=/bin/sh
|
||||
PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin/:/usr/local/sbin/
|
||||
# Order of crontab fields
|
||||
# minute hour mday month wday command
|
||||
# Reference: https://www.freebsd.org/doc/handbook/configtuning-cron.html
|
||||
# Reference: crontab(5).
|
||||
@weekly lerentis cron_mail restic_backup.sh
|
||||
@monthly lerentis cron_mail restic_check.sh
|
1
etc/restic/pw.txt
Normal file
1
etc/restic/pw.txt
Normal file
@ -0,0 +1 @@
|
||||
PASSWORD GOES HERES
|
10
etc/systemd/system/restic-backup.service
Normal file
10
etc/systemd/system/restic-backup.service
Normal file
@ -0,0 +1,10 @@
|
||||
[Unit]
|
||||
Description=Backup with restic to Backblaze B2
|
||||
OnFailure=status-email-user@%n.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Nice=10
|
||||
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/"
|
9
etc/systemd/system/restic-backup.timer
Normal file
9
etc/systemd/system/restic-backup.timer
Normal file
@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=Backup with restic on schedule
|
||||
|
||||
[Timer]
|
||||
OnCalendar=weekly
|
||||
Persistent=true
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
9
etc/systemd/system/restic-check.service
Normal file
9
etc/systemd/system/restic-check.service
Normal file
@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=Check restic backup Backblaze B2 for errors
|
||||
OnFailure=status-email-user@%n.service
|
||||
Conflicts=restic.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
Nice=10
|
||||
ExecStart=/usr/local/sbin/restic_check.sh
|
9
etc/systemd/system/restic-check.timer
Normal file
9
etc/systemd/system/restic-check.timer
Normal file
@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=Check restic backup for errors on a schedule
|
||||
|
||||
[Timer]
|
||||
OnCalendar=monthly
|
||||
Persistent=true
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
11
etc/systemd/system/status-email-user@.service
Normal file
11
etc/systemd/system/status-email-user@.service
Normal file
@ -0,0 +1,11 @@
|
||||
# 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
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/bin/notify-send "Backup Status:" %i
|
||||
User=lerentis
|
||||
Group=systemd-journal
|
Reference in New Issue
Block a user