add systemd setup for tarsnap

This commit is contained in:
Rob Watson 2020-06-29 00:00:36 +02:00
parent 68bf4e932d
commit 7d3d5e4ed0
2 changed files with 29 additions and 0 deletions

12
systemd/tarsnap.service Normal file
View File

@ -0,0 +1,12 @@
# systemctl enable /path/to/this/unit-file
[Unit]
Description=Backup documents folder to Tarsnap
Wants=tarsnap.timer
[Service]
ExecStart=/bin/sh -c "/usr/bin/tarsnap -c --print-stats -f \"$(uname -n)-$(date +%%Y-%%m-%%d_%%H-%%M-%%S)\" /home/rob/Documents/"
WorkingDirectory=/root
[Install]
WantedBy=multi-user.target

17
systemd/tarsnap.timer Normal file
View File

@ -0,0 +1,17 @@
# systemctl enable /path/to/this/unit-file
[Unit]
Description=Run tarsnap.service every six hours
Requires=tarsnap.service
[Timer]
Unit=tarsnap.service
OnCalendar=*-*-* 00:00:00
OnCalendar=*-*-* 06:00:00
OnCalendar=*-*-* 12:00:00
OnCalendar=*-*-* 18:00:00
RandomizedDelaySec=3m
AccuracySec=1s
[Install]
WantedBy=timers.target