From 389f7be86f07a08a6282e02913a676aeef328db5 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Wed, 19 May 2021 23:39:10 +0200 Subject: syncoid: run vs pull and fix autosuspend timer --- .../zfs/syncoid/templates/autosuspend.timer.j2 | 2 +- .../storage/zfs/syncoid/templates/pull.service.j2 | 22 ++++++++++++++++++++++ roles/storage/zfs/syncoid/templates/pull.timer.j2 | 9 +++++++++ roles/storage/zfs/syncoid/templates/run.service.j2 | 22 ---------------------- roles/storage/zfs/syncoid/templates/run.timer.j2 | 9 --------- 5 files changed, 32 insertions(+), 32 deletions(-) create mode 100644 roles/storage/zfs/syncoid/templates/pull.service.j2 create mode 100644 roles/storage/zfs/syncoid/templates/pull.timer.j2 delete mode 100644 roles/storage/zfs/syncoid/templates/run.service.j2 delete mode 100644 roles/storage/zfs/syncoid/templates/run.timer.j2 (limited to 'roles/storage/zfs/syncoid/templates') diff --git a/roles/storage/zfs/syncoid/templates/autosuspend.timer.j2 b/roles/storage/zfs/syncoid/templates/autosuspend.timer.j2 index 5c0b3329..40852739 100644 --- a/roles/storage/zfs/syncoid/templates/autosuspend.timer.j2 +++ b/roles/storage/zfs/syncoid/templates/autosuspend.timer.j2 @@ -2,7 +2,7 @@ Description=automatic system suspender for syncoid-based backups [Timer] -OnCalendar=*-*-* *-03/10-00 +OnCalendar=*-*-* *:03/10:00 [Install] WantedBy=timers.target diff --git a/roles/storage/zfs/syncoid/templates/pull.service.j2 b/roles/storage/zfs/syncoid/templates/pull.service.j2 new file mode 100644 index 00000000..33283576 --- /dev/null +++ b/roles/storage/zfs/syncoid/templates/pull.service.j2 @@ -0,0 +1,22 @@ +[Unit] +Description=syncoid-based backup for {{ item.key }} + +[Service] +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 zfs_syncoid_autosuspend %} +ExecStart=/var/lib/syncoid/syncoid_post +{% endif %} +{% if 'periodic' in item.value %} +TimeoutStartSec={{ item.value.periodic.timeout }} +{% endif %} +PrivateTmp=yes +ProtectHome=yes +ProtectKernelTunables=yes +ProtectControlGroups=yes +RestrictRealtime=yes + +[Install] +WantedBy=multi-user.target diff --git a/roles/storage/zfs/syncoid/templates/pull.timer.j2 b/roles/storage/zfs/syncoid/templates/pull.timer.j2 new file mode 100644 index 00000000..cc252854 --- /dev/null +++ b/roles/storage/zfs/syncoid/templates/pull.timer.j2 @@ -0,0 +1,9 @@ +[Unit] +Description=syncoid-based backup for {{ item.key }} + +[Timer] +OnCalendar={{ item.value.periodic.schedule }} +WakeSystem={{ zfs_syncoid_autosuspend | ternary('true', 'false') }} + +[Install] +WantedBy=timers.target diff --git a/roles/storage/zfs/syncoid/templates/run.service.j2 b/roles/storage/zfs/syncoid/templates/run.service.j2 deleted file mode 100644 index 33283576..00000000 --- a/roles/storage/zfs/syncoid/templates/run.service.j2 +++ /dev/null @@ -1,22 +0,0 @@ -[Unit] -Description=syncoid-based backup for {{ item.key }} - -[Service] -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 zfs_syncoid_autosuspend %} -ExecStart=/var/lib/syncoid/syncoid_post -{% endif %} -{% if 'periodic' in item.value %} -TimeoutStartSec={{ item.value.periodic.timeout }} -{% endif %} -PrivateTmp=yes -ProtectHome=yes -ProtectKernelTunables=yes -ProtectControlGroups=yes -RestrictRealtime=yes - -[Install] -WantedBy=multi-user.target diff --git a/roles/storage/zfs/syncoid/templates/run.timer.j2 b/roles/storage/zfs/syncoid/templates/run.timer.j2 deleted file mode 100644 index cc252854..00000000 --- a/roles/storage/zfs/syncoid/templates/run.timer.j2 +++ /dev/null @@ -1,9 +0,0 @@ -[Unit] -Description=syncoid-based backup for {{ item.key }} - -[Timer] -OnCalendar={{ item.value.periodic.schedule }} -WakeSystem={{ zfs_syncoid_autosuspend | ternary('true', 'false') }} - -[Install] -WantedBy=timers.target -- cgit v1.2.3