Debian Codegraph @

sample/systemd/borgmatic.service

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
1 [Unit]
2 Description=borgmatic backup
3 Wants=network-online.target
4 After=network-online.target
5 # Prevent borgmatic from running unless the machine is plugged into power. Remove this line if you
6 # want to allow borgmatic to run anytime.
7 ConditionACPower=true
8 Documentation=https://torsion.org/borgmatic/
•9 ConditionFileNotEmpty=|/etc/borgmatic/config.yaml
10 ConditionPathExistsGlob=|/etc/borgmatic.d/*.yaml
11
12 [Service]
13 Type=oneshot
14 RuntimeDirectory=borgmatic
15 StateDirectory=borgmatic
16
17 # Load single encrypted credential.
18 LoadCredentialEncrypted=borgmatic.pw
19
20 # Load multiple encrypted credentials.
21 # LoadCredentialEncrypted=borgmatic:/etc/credstore.encrypted/borgmatic/
22
23 # Security settings for systemd running as root, optional but recommended to improve security. You
24 # can disable individual settings if they cause problems for your use case. For more details, see
25 # the systemd manual: https://www.freedesktop.org/software/systemd/man/systemd.exec.html
26 LockPersonality=true
27 # Certain borgmatic features like Healthchecks integration need MemoryDenyWriteExecute to be off.
28 # But you can try setting it to "yes" for improved security if you don't use those features.
29 MemoryDenyWriteExecute=no
30 NoNewPrivileges=yes
31 # Filesystem hooks like ZFS may not work unless PrivateDevices is disabled.
32 PrivateDevices=yes
33 PrivateTmp=yes
34 ProtectClock=yes
35 ProtectControlGroups=yes
36 ProtectHostname=yes
37 ProtectKernelLogs=yes
38 ProtectKernelModules=yes
39 ProtectKernelTunables=yes
40 RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 AF_NETLINK
41 RestrictNamespaces=yes
42 RestrictRealtime=yes
43 RestrictSUIDSGID=yes
44 SystemCallArchitectures=native
45 SystemCallFilter=@system-service @mount
46 SystemCallErrorNumber=EPERM
47 # To restrict write access further, change "ProtectSystem" to "strict" and
48 # uncomment "ReadWritePaths", "TemporaryFileSystem", "BindPaths" and
49 # "BindReadOnlyPaths". Then add any local repository paths to the list of
50 # "ReadWritePaths". This leaves most of the filesystem read-only to borgmatic.
51 ProtectSystem=full
52 # ReadWritePaths=-/mnt/my_backup_drive
53 # This will mount a tmpfs on top of /root and pass through needed paths
54 # TemporaryFileSystem=/root:ro
55 # BindPaths=-/root/.cache/borg -/root/.config/borg -/root/.borgmatic
56 # BindReadOnlyPaths=-/root/.ssh
57
58 # May interfere with running external programs within borgmatic hooks. This
59 # includes, for instance, programs to snapshot filesystems (e.g. ZFS).
60 CapabilityBoundingSet=CAP_DAC_READ_SEARCH CAP_NET_RAW
61
62 # Lower CPU and I/O priority.
63 Nice=19
64 CPUSchedulingPolicy=batch
65 IOSchedulingClass=best-effort
66 IOSchedulingPriority=7
67 IOWeight=100
68
69 Restart=no
70 # Prevent rate limiting of borgmatic log events. If you are using an older version of systemd that
71 # doesn't support this (pre-240 or so), you may have to remove this option.
72 LogRateLimitIntervalSec=0
73
74 # Delay start to prevent backups running during boot. Note that systemd-inhibit requires dbus and
75 # dbus-user-session to be installed.
76 ExecStartPre=sleep 1m
•77 ExecStart=systemd-inhibit --who="borgmatic" --what="sleep:shutdown" --why="Prevent interrupting scheduled backup" /usr/bin/borgmatic --verbosity -2 --syslog-verbosity 1