From fd1363eedadb183c439a00e143fd05ba8e10ad31 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Sun, 2 May 2021 16:45:47 +0200 Subject: add timer for syncoid backups --- roles/storage/zfs/syncoid/templates/systemd.service.j2 | 3 +++ roles/storage/zfs/syncoid/templates/systemd.timer.j2 | 8 ++++++++ 2 files changed, 11 insertions(+) create mode 100644 roles/storage/zfs/syncoid/templates/systemd.timer.j2 (limited to 'roles/storage/zfs/syncoid/templates') diff --git a/roles/storage/zfs/syncoid/templates/systemd.service.j2 b/roles/storage/zfs/syncoid/templates/systemd.service.j2 index ada34336..0d214595 100644 --- a/roles/storage/zfs/syncoid/templates/systemd.service.j2 +++ b/roles/storage/zfs/syncoid/templates/systemd.service.j2 @@ -6,6 +6,9 @@ Type=oneshot {% for path,config in item.value.paths.items() %} ExecStart=/var/lib/syncoid/syncoid_wrapper --dumpsnaps --quiet {{ config.recursive | default(false) | ternary('-r ', '') }}{{ config.skip_parent | default(false) | ternary('--skip-parent ', '') }}{% for re in config.exclude | default([]) %}--exclude='{{ re }}' {% endfor %}{% if 'ssh_port' in item.value %}--sshport {{ item.value.ssh_port }} {% endif %}root@{{ item.value.ssh_hostname }}:{{ path }} {{ zfs_syncoid_target_pool }}/{{ item.key }}/{{ path }} {% endfor %} +{% if 'periodic' in item.value %} +TimeoutStartSec={{ item.value.periodic.timeout }} +{% endif %} PrivateTmp=yes ProtectHome=yes ProtectKernelTunables=yes diff --git a/roles/storage/zfs/syncoid/templates/systemd.timer.j2 b/roles/storage/zfs/syncoid/templates/systemd.timer.j2 new file mode 100644 index 00000000..260a8938 --- /dev/null +++ b/roles/storage/zfs/syncoid/templates/systemd.timer.j2 @@ -0,0 +1,8 @@ +[Unit] +Description=syncoid-based backup for {{ item.key }} + +[Timer] +OnCalendar={{ item.value.periodic.schedule }} + +[Install] +WantedBy=timers.target -- cgit v1.2.3