Put files in directory structure
This commit is contained in:
8
etc/restic/b2_env.sh
Normal file
8
etc/restic/b2_env.sh
Normal file
@@ -0,0 +1,8 @@
|
||||
# B2 credentials.
|
||||
# Extracted settings so both systemd timers and user can just source this when want to work on my B2 backup.
|
||||
# See https://restic.readthedocs.io/en/latest/030_preparing_a_new_repo.html
|
||||
|
||||
export RESTIC_REPOSITORY="b2:<b2-repo-name>"
|
||||
export RESTIC_PASSWORD_FILE="/etc/restic/b2_pw.txt"
|
||||
export B2_ACCOUNT_ID="<restic-account-id>"
|
||||
export B2_ACCOUNT_KEY="<restic-account-key>"
|
||||
1
etc/restic/b2_pw.txt
Normal file
1
etc/restic/b2_pw.txt
Normal file
@@ -0,0 +1 @@
|
||||
<restic-password>
|
||||
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=/root"
|
||||
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=daily
|
||||
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 Backblaze B2 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/local/sbin/systemd-email abc@gmail.com %i
|
||||
User=root
|
||||
Group=systemd-journal
|
||||
Reference in New Issue
Block a user