diff --git a/systemd/tarsnap.service b/systemd/tarsnap.service new file mode 100644 index 0000000..a0792b6 --- /dev/null +++ b/systemd/tarsnap.service @@ -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 diff --git a/systemd/tarsnap.timer b/systemd/tarsnap.timer new file mode 100644 index 0000000..6a34e1d --- /dev/null +++ b/systemd/tarsnap.timer @@ -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