User:Erikw/Restic

From ArchWiki
Jump to: navigation, search

Restic

restic is a command-line tool for making backups, the right way. Check the official website for a feature explanation.

Automatic scheduled backup

Unfortunately restic does not come per-configured with a way to run automated backups, say every day. However it's possible to set this up yourself using. This example also features email notifications when a backup fails to complete.

This solution has a few different files which can be found here.

Put these files in /usr/local/sbin:

  • restic_backup.sh: A script that defines how to run the backup.
  • systemd-email: Sends email using sendmail (must be configured). Also features time-out for not spamming Gmail servers. Edit the email target address in this file.

Put these files in /etc/systemd/system/:

  • restic-backup.service: A service that calls the script above.
  • restic-backup.timer: A timer (systemd's cronjobs) that starts the backup every day.
  • status-email-user@.service: A service that can notify you via email when a systemd service fails.


Now simply enable the timer with

$ systemctl enable restic-backup.timer

and enjoy your computer being backed up every day!