From 87bf6fac6898c3673c7f9d74ec55d3594dc19fca Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Sat, 12 Feb 2022 11:29:26 +0100 Subject: [PATCH] bundles/zfs: use systemd-timers for zfs snapshots --- bundles/zfs/metadata.py | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/bundles/zfs/metadata.py b/bundles/zfs/metadata.py index 01e3b38..ba301f1 100644 --- a/bundles/zfs/metadata.py +++ b/bundles/zfs/metadata.py @@ -35,14 +35,6 @@ defaults = { }, }, }, - 'cron': { - 'jobs': { - 'zfs-auto-snapshot-daily': '0 0 * * * root /usr/local/sbin/zfs-auto-snapshot daily', - 'zfs-auto-snapshot-hourly': '0 * * * * root /usr/local/sbin/zfs-auto-snapshot hourly', - 'zfs-auto-snapshot-monthly': '0 0 1 * * root /usr/local/sbin/zfs-auto-snapshot monthly', - 'zfs-auto-snapshot-weekly': '0 0 * * 7 root /usr/local/sbin/zfs-auto-snapshot weekly', - }, - }, 'icinga2_api': { 'zfs': { 'services': { @@ -77,6 +69,26 @@ defaults = { }, }, }, + 'systemd-timers': { + 'timers': { + 'zfs-auto-snapshot-daily': { + 'when': 'daily', + 'command': '/usr/local/sbin/zfs-auto-snapshot daily', + }, + 'zfs-auto-snapshot-hourly': { + 'when': 'hourly', + 'command': '/usr/local/sbin/zfs-auto-snapshot hourly', + }, + 'zfs-auto-snapshot-monthly': { + 'when': 'monthly', + 'command': '/usr/local/sbin/zfs-auto-snapshot monthly', + }, + 'zfs-auto-snapshot-weekly': { + 'when': 'weekly', + 'command': '/usr/local/sbin/zfs-auto-snapshot weekly', + }, + }, + }, 'zfs': { 'datasets': {}, 'pools': {},