From 3846155d624e94caa972a1e2fba4d39390a846f2 Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Tue, 24 Sep 2019 10:16:30 -0700 Subject: [PATCH] More robust sample systemd service: boot delay, network dependency, lowered CPU/IO priority, etc (#205). --- NEWS | 4 ++++ sample/systemd/borgmatic.service | 16 +++++++++++++++- setup.py | 2 +- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 49a7e8b..3e0bed8 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +1.3.20.dev0 + * #205: More robust sample systemd service: boot delay, network dependency, lowered CPU/IO + priority, etc. + 1.3.19 * #219: Fix visibility of "borgmatic prune --stats" output. diff --git a/sample/systemd/borgmatic.service b/sample/systemd/borgmatic.service index 11e3b52..61fdcea 100644 --- a/sample/systemd/borgmatic.service +++ b/sample/systemd/borgmatic.service @@ -1,7 +1,21 @@ [Unit] Description=borgmatic backup +Wants=network-online.target +After=network-online.target [Service] Type=oneshot -ExecStart=/root/.local/bin/borgmatic + +# Lower CPU and I/O priority. +Nice=19 +CPUSchedulingPolicy=batch +IOSchedulingClass=best-effort +IOSchedulingPriority=7 +IOWeight=100 + +Restart=no LogRateLimitIntervalSec=0 + +# Delay start to prevent backups running during boot. +ExecStartPre=sleep 1m +ExecStart=systemd-inhibit --who="borgmatic" --why="Prevent interrupting scheduled backup" /root/.local/bin/borgmatic --syslog-verbosity 1 diff --git a/setup.py b/setup.py index adf8953..e821e47 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import find_packages, setup -VERSION = '1.3.19' +VERSION = '1.3.20.dev0' setup(