Verified Commit fffc225e authored by Sven-Hendrik Haase's avatar Sven-Hendrik Haase
Browse files

Split out borg into two services

The reason is that we might want to independently retry the offsite backup in case it fails but not rerun the primary backup in that case.
This isn't possible with the current setup and so we'll have to split this up into two oneshot services.
The way it works is that borg-backup.service will schedule borg-backup-offsite.service to run after it which ensures that
no two backups are running at the same time and also that they can be indendently retried if one of them fails.
parent 21ec4202
Pipeline #4885 passed with stage
in 43 seconds
[Unit]
Description=Borg backup (offsite)
[Service]
Type=oneshot
Restart=on-failure
RestartSec=5m
ExecStart=/usr/local/bin/borg-backup-offsite.sh
[Unit]
Description=Borg backup
Wants=borg-backup-offsite.service
Before=borg-backup-offsite.service
[Service]
Type=oneshot
Restart=on-failure
RestartSec=5m
{% for backup in backup_hosts %}
ExecStart=/usr/local/bin/borg-backup{{ backup['suffix'] }}.sh
{% endfor %}
ExecStart=/usr/local/bin/borg-backup.sh
......@@ -58,10 +58,11 @@
when: inventory_hostname == "gitlab.archlinux.org"
- name: install systemd timer and service for backup
template: src={{ item }}.j2 dest=/etc/systemd/system/{{ item }} owner=root group=root mode=0644
copy: src={{ item }} dest=/etc/systemd/system/{{ item }} owner=root group=root mode=0644
with_items:
- borg-backup.timer
- borg-backup.service
- borg-backup-offsite.service
- name: activate systemd timers for backup
systemd: name=borg-backup.timer enabled=yes state=started daemon-reload=yes
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment