From 87eeefa0caf610912bf6ba835f407f607e9a9da0 Mon Sep 17 00:00:00 2001 From: Christoph Anton Mitterer Date: Sat, 12 Nov 2022 04:45:00 +0100 Subject: [PATCH 1/3] contrib: systemd: btrbk.timer: run hourly btrbk supports hourly backups, so it makes sense for the timer to run hourly, too. Signed-off-by: Christoph Anton Mitterer --- contrib/systemd/btrbk.timer.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/systemd/btrbk.timer.in b/contrib/systemd/btrbk.timer.in index eda96042..90924bba 100644 --- a/contrib/systemd/btrbk.timer.in +++ b/contrib/systemd/btrbk.timer.in @@ -2,7 +2,7 @@ Description=btrbk daily backup [Timer] -OnCalendar=daily +OnCalendar=hourly AccuracySec=10min Persistent=true From c9d95a6302cb13ddfb1bd1df2f845c16acda2cd0 Mon Sep 17 00:00:00 2001 From: Christoph Anton Mitterer Date: Sat, 12 Nov 2022 04:55:34 +0100 Subject: [PATCH 2/3] contrib: systemd: run units only with existing config file It does not make sense for the timer or the service to be started (the latter when done so manually) when neither of the two default config files exists. Signed-off-by: Christoph Anton Mitterer --- contrib/systemd/btrbk.service.in | 2 ++ contrib/systemd/btrbk.timer.in | 2 ++ 2 files changed, 4 insertions(+) diff --git a/contrib/systemd/btrbk.service.in b/contrib/systemd/btrbk.service.in index 0f36f41f..d3fdf8f7 100644 --- a/contrib/systemd/btrbk.service.in +++ b/contrib/systemd/btrbk.service.in @@ -1,6 +1,8 @@ [Unit] Description=btrbk backup Documentation=man:btrbk(1) +ConditionPathExists=|@CONFDIR@/btrbk/btrbk.conf +ConditionPathExists=|@CONFDIR@/btrbk.conf [Service] Type=oneshot diff --git a/contrib/systemd/btrbk.timer.in b/contrib/systemd/btrbk.timer.in index 90924bba..0da6c15a 100644 --- a/contrib/systemd/btrbk.timer.in +++ b/contrib/systemd/btrbk.timer.in @@ -1,5 +1,7 @@ [Unit] Description=btrbk daily backup +ConditionPathExists=|@CONFDIR@/btrbk/btrbk.conf +ConditionPathExists=|@CONFDIR@/btrbk.conf [Timer] OnCalendar=hourly From eb1d9e4da96dbcd0e3b9eb0eb74d4488e5c0c538 Mon Sep 17 00:00:00 2001 From: Christoph Anton Mitterer Date: Sat, 12 Nov 2022 04:59:19 +0100 Subject: [PATCH 3/3] contrib: systemd: btrbk.timer: use default systemd `AccuracySec` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit systemd’s `AccuracySec` is mainly there in order to allow it to coalescing wake-ups for multiple timers. It’s default of `1min` minute should be enough for this. Using its `RandomizedDelaySec` in order to spread load from e.g. multiple sources that would all perform backups to one target, wouldn’t really make much sense either. Either, the value would need to be quite large, thereby making backups/snapshots too wobbly, or it wouldn’t be effective as at least the backups typically take quite some time. Signed-off-by: Christoph Anton Mitterer --- contrib/systemd/btrbk.timer.in | 1 - 1 file changed, 1 deletion(-) diff --git a/contrib/systemd/btrbk.timer.in b/contrib/systemd/btrbk.timer.in index 0da6c15a..96760eec 100644 --- a/contrib/systemd/btrbk.timer.in +++ b/contrib/systemd/btrbk.timer.in @@ -5,7 +5,6 @@ ConditionPathExists=|@CONFDIR@/btrbk.conf [Timer] OnCalendar=hourly -AccuracySec=10min Persistent=true [Install]