From 1d7c7eaaa7ec0ab67add6e95c7a95a14ec1498ca Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Wed, 14 Jun 2023 14:57:57 -0700 Subject: [PATCH] Add sample systemd user serivce for running borgmatic as a non-root user (#669). --- NEWS | 1 + sample/systemd/borgmatic-user.service | 15 +++++++++++++++ sample/systemd/borgmatic-user.timer | 1 + 3 files changed, 17 insertions(+) create mode 100644 sample/systemd/borgmatic-user.service create mode 120000 sample/systemd/borgmatic-user.timer diff --git a/NEWS b/NEWS index 15344100..a5a1014e 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,7 @@ 1.7.15.dev0 * #697: Extract borgmatic configuration from backup via "bootstrap" action—even when borgmatic has no configuration yet! + * #669: Add sample systemd user serivce for running borgmatic as a non-root user. 1.7.14 * #484: Add a new verbosity level (-2) to disable output entirely (for console, syslog, log file, diff --git a/sample/systemd/borgmatic-user.service b/sample/systemd/borgmatic-user.service new file mode 100644 index 00000000..e5b4280b --- /dev/null +++ b/sample/systemd/borgmatic-user.service @@ -0,0 +1,15 @@ +[Unit] +Description=borgmatic backup +Wants=network-online.target +After=network-online.target +ConditionACPower=true + +[Service] +Type=oneshot +Restart=no +# Prevent rate limiting of borgmatic log events. If you are using an older version of systemd that +# doesn't support this (pre-240 or so), you may have to remove this option. +LogRateLimitIntervalSec=0 +# Delay start to prevent backups running during boot. +ExecStartPre=sleep 1m +ExecStart=/root/.local/bin/borgmatic --verbosity -2 --syslog-verbosity 1 diff --git a/sample/systemd/borgmatic-user.timer b/sample/systemd/borgmatic-user.timer new file mode 120000 index 00000000..19e3f350 --- /dev/null +++ b/sample/systemd/borgmatic-user.timer @@ -0,0 +1 @@ +borgmatic.timer \ No newline at end of file