Skip to content

Instantly share code, notes, and snippets.

@eliasp
Last active April 23, 2018 06:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eliasp/69658f06c9706e3681a741b1d0019f60 to your computer and use it in GitHub Desktop.
Save eliasp/69658f06c9706e3681a741b1d0019f60 to your computer and use it in GitHub Desktop.
[Unit]
Description=Backup %I using 'restic'
ConditionFileNotEmpty=/etc/restic/%i/restic.env
ConditionPathExists=/etc/restic/%i/backup.exclude
[Service]
# /run, /tmp are intentionally not --exclude'd as those are tmpfs anyways and therefore already excluded by --one-file-system
ExecStart=/usr/local/bin/restic backup --cache-dir=/var/cache/restic/%i --one-file-system --exclude-file=/etc/restic/%i/backup.exclude --exclude=/var/cache/* --exclude=/var/tmp/* --exclude=/home/*/.cache/* /
Type=simple
EnvironmentFile=/etc/restic/%i/restic.env
DynamicUser=yes
PrivateTmp=no
PrivateDevices=yes
CacheDirectory=restic/%i
CacheDirectoryMode=0700
ConfigurationDirectory=restic/%i
ConfigurationDirectoryMode=0700
LogsDirectory=restic/%i
SystemCallFilter=@basic-io @default @file-system @io-event @network-io @process @signal getrandom ioctl sched_getaffinity
SystemCallErrorNumber=EPERM
AmbientCapabilities=CAP_DAC_READ_SEARCH
IPAccounting=yes
IOSchedulingClass=idle
CPUSchedulingPolicy=idle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment