Systemd configuration for a backups using Restic.
These backup services are based on the ones described in Automate backups with restic and systemd in Fedora Magazine, but modified to fit my setup.
This package is available from the
chrisbouchard/upliftinglemma Copr. Assuming you're
using a recent version of Fedora, you can install using dnf
.
$ dnf copr enable chrisbouchard/upliftinglemma
$ dnf install restic-backup
You may have to agree to some prompts if this is the first Copr you've enabled.
There are two main timers and services in this package, and a couple support services.
This service is responsible for running the backup via restic backup
and for
tagging backups to be deleted via restic forget
. The restic-backup.timer
will run this service every night at midnight.
Note: This service won't actually delete any backups. That's handled by the next service.
This service deletes the backups that were marked for delete in the previous
service using restic prune
. The restic-prune.timer
will run this service
once a month at midnight on the first of the month.
This service mounts your restic backups at the configured mount point (restic mount
) so you can explore your backups using the filesystem.
This service is used by the others to report failures using notify-send
.
Once the configuration is done, you can enable backups with
$ systemctl --user enable --now restic-backup.timer
$ systemctl --user enable --now restic-prune.timer
Restic Backup is configured using a systemd environment
file, which by default is
$XDG_CONFIG_DIR/restic-backup/restic-backup.conf
BACKUP_EXCLUDE_FILES
: List of exclude files, separated with colons (:
). For more information about exclude files, see the restic docs.- Default:
$XDG_CONFIG_DIR/restic-backup/exclude
- Default:
BACKUP_EXCLUDE_IF_PRESENT
: List of exclude-if-present filenames, separated with colons (:
). If any of these filenames are present in a directory, the directory will be ignored for backup.- Default:
.restic_exclude
- Default:
BACKUP_PATHS
: List of paths to include in the backups, separated with colons (:
).- Default:
$HOME
- Default:
BACKUP_VERBOSE
: Verbosity level of therestic backup
command.- Default:
0
- Default:
FORGET_DAILY
: Number of daily backups to keep. See restic docs for more information.- Default: unset
FORGET_MONTHLY
: Number of monthly backups to keep. See restic docs for more information.- Default: unset
FORGET_WEEKLY
: Number of weekly backups to keep. See restic docs for more information.- Default: unset
FORGET_YEARLY
: Number of yearly backups to keep. See restic docs for more information.- Default: unset
FORGET_VERBOSE
: Verbosity level of therestic forget
command.- Default:
0
- Default:
MOUNT_PATH
: Mount point forrestic mount
.- Default:
$HOME/Restic
- Default:
MOUNT_VERBOSE
: Verbosity level of therestic prune
command.- Default:
0
- Default:
PRUNE_VERBOSE
: Verbosity level of therestic prune
command.- Default:
0
- Default:
UNLOCK_VERBOSE
: Verbosity level of therestic unlock
command.- Default:
0
- Default: