Jelajahi Sumber

Add sample systemd user serivce for running borgmatic as a non-root user (#669).

Dan Helfman 2 tahun lalu
induk
melakukan
1d7c7eaaa7
3 mengubah file dengan 17 tambahan dan 0 penghapusan
  1. 1 0
      NEWS
  2. 15 0
      sample/systemd/borgmatic-user.service
  3. 1 0
      sample/systemd/borgmatic-user.timer

+ 1 - 0
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,

+ 15 - 0
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

+ 1 - 0
sample/systemd/borgmatic-user.timer

@@ -0,0 +1 @@
+borgmatic.timer