added systemd services
This commit is contained in:
parent
420be44f56
commit
baa9bd7bed
8 changed files with 67 additions and 5 deletions
14
templates/backup-check.j2
Executable file
14
templates/backup-check.j2
Executable file
|
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
{% if backup_backend == 'restic' %}
|
||||
# restic backend
|
||||
source /etc/backup-client/restic.env
|
||||
|
||||
restic check --read-data
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% if not backup_backend %}
|
||||
echo "Noop, backup is handled external"
|
||||
{% endif %}
|
||||
10
templates/backup-check.service.j2
Normal file
10
templates/backup-check.service.j2
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
[Unit]
|
||||
Description=Check backup consistency
|
||||
OnFailure=status-email-root@%n.service
|
||||
|
||||
[Service]
|
||||
Nice=19
|
||||
IOSchedulingClass=idle
|
||||
Type=simple
|
||||
ExecStart=/usr/local/bin/backup-check
|
||||
|
||||
|
|
@ -7,7 +7,3 @@ set -euo pipefail
|
|||
{% if backups.mode in ['hypervisor-restic'] %}
|
||||
backup-all-vms
|
||||
{% endif %}
|
||||
{% if backup_executor %}
|
||||
backup-retention
|
||||
{% endif %}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ source /etc/backup-client/retention.env
|
|||
# restic backend
|
||||
source /etc/backup-client/restic.env
|
||||
restic forget \
|
||||
--cleanup-cache \
|
||||
--verbose \
|
||||
--prune \
|
||||
--group-by "host,paths,tags" \
|
||||
|
|
@ -17,3 +18,6 @@ restic forget \
|
|||
--keep-yearly ${BACKUP_RETENTION_YEARS}
|
||||
|
||||
{% endif %}
|
||||
{% if not backup_backend %}
|
||||
echo "Noop, backup is handled external"
|
||||
{% endif %}
|
||||
|
|
|
|||
10
templates/backup-retention.service.j2
Normal file
10
templates/backup-retention.service.j2
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
[Unit]
|
||||
Description=Delete no longer needed backups
|
||||
OnFailure=status-email-root@%n.service
|
||||
|
||||
[Service]
|
||||
Nice=19
|
||||
IOSchedulingClass=idle
|
||||
Type=simple
|
||||
ExecStart=/usr/local/bin/backup-retention
|
||||
|
||||
10
templates/backup-run.service.j2
Normal file
10
templates/backup-run.service.j2
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
[Unit]
|
||||
Description=Backup system
|
||||
OnFailure=status-email-root@%n.service
|
||||
|
||||
[Service]
|
||||
Nice=19
|
||||
IOSchedulingClass=idle
|
||||
Type=simple
|
||||
ExecStart=/usr/local/bin/backup-full
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue