Hello, I’ve created a Systemd unit to backup my Remarkable table periodically, using an rclone remote as backup repository. Here’s the unit file:
[Unit]
Description=Automatic and periodic backups
[Service]
Type=simple
# rclone needs to be in te $PATH and restic wants to know where its cache dir is
Environment="PATH=/opt/bin"
Environment="HOME=/home/root"
Environment="GOMAXPROCS=1"
Environment="RESTIC_REPOSITORY=rclone:onedrive:Backups/Pergaminho"
Environment="RESTIC_PASSWORD=..."
ExecCondition=/bin/ping -c 1 -W 5 8.8.8.8
ExecCondition=/home/root/.local/share/bin/check-restic.sh
ExecCondition=/home/root/.local/share/bin/check-timestamp.sh /home/root/.local/share/remarkable/xochitl.backup.time
ExecStartPre=/home/root/.local/share/bin/update-timestamp.sh
ExecStart=/opt/bin/restic backup --quiet --no-scan --skip-if-unchanged /home/root/.local/share/remarkable/xochitl/
There’s 3 ExecCondition
which are used to ensure that 1) internet is connected, 2) no other instances of restic are running in the background and 3) that the last backup was more than 24h ago. This unit is triggered by a Systemd timer.
When the backup is successful, this is the output:
Jul 31 12:03:46 pergaminho systemd[1]: Starting Automatic and periodic backups...
Jul 31 12:03:46 pergaminho ping[9015]: PING 8.8.8.8 (8.8.8.8): 56 data bytes
Jul 31 12:03:46 pergaminho ping[9015]: 64 bytes from 8.8.8.8: seq=0 ttl=117 time=67.080 ms
Jul 31 12:03:46 pergaminho ping[9015]: --- 8.8.8.8 ping statistics ---
Jul 31 12:03:46 pergaminho ping[9015]: 1 packets transmitted, 1 packets received, 0% packet loss
Jul 31 12:03:46 pergaminho ping[9015]: round-trip min/avg/max = 67.080/67.080/67.080 ms
Jul 31 12:03:46 pergaminho check-restic.sh[9019]: restic is not running in the background
Jul 31 12:03:46 pergaminho check-timestamp.sh[9021]: timestamp is older than 24h
Jul 31 12:03:46 pergaminho systemd[1]: Started Automatic and periodic backups.
Jul 31 12:03:55 pergaminho systemd[1]: backup.service: Killing process 9036 (rclone) with signal SIGKILL.
Jul 31 12:03:55 pergaminho systemd[1]: backup.service: Succeeded.
Emphasis on the second to last line, where it says its killing rclone with SIGKILL. Running restic snapshots
shows the last snapshot is there and looks okay, but I’m still a little bit worried about sending a SIGKILL to forcefully shutdown rclone.
Is this okay? Are there more checks that I could do?