Created
July 30, 2020 16:33
-
-
Save patryk/e8a19393f57a054cb87aafff1b00652d to your computer and use it in GitHub Desktop.
restic systemd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BACKUP_PATHS="/etc /home /root /var/lib/mysql" | |
BACKUP_EXCLUDES="--exclude-file /home/rupert/.restic_excludes --exclude-if-present .exclude_from_backup --exclude-caches" | |
RETENTION_DAYS=7 | |
RETENTION_WEEKS=4 | |
RETENTION_MONTHS=6 | |
RETENTION_YEARS=3 | |
B2_ACCOUNT_ID=xxx | |
B2_ACCOUNT_KEY=yyy | |
RESTIC_REPOSITORY=b2:patryk-restic-backups:/restic/backup/felucia | |
RESTIC_PASSWORD=zzz | |
XDG_CACHE_HOME=/var/cache/restic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Restic backup service | |
[Service] | |
Type=oneshot | |
ExecStart=/usr/bin/restic backup --one-file-system --tag systemd.timer $BACKUP_EXCLUDES $BACKUP_PATHS | |
ExecStartPost=/usr/bin/restic forget --tag systemd.timer --group-by "paths,tags" --keep-daily $RETENTION_DAYS --keep-weekly $RETENTION_WEEKS --keep-monthly $RETENTION_MONTHS --keep-yearly $RETENTION_YEARS | |
EnvironmentFile=/etc/restic-backup.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Backup with restic daily | |
[Timer] | |
OnCalendar=daily | |
RandomizedDelaySec=5min | |
Persistent=true | |
[Install] | |
WantedBy=timers.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Restic backup service (data pruning) | |
[Service] | |
Type=oneshot | |
ExecStart=/usr/bin/restic prune | |
EnvironmentFile=/etc/restic-backup.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Prune data from the restic repository monthly | |
[Timer] | |
OnCalendar=monthly | |
RandomizedDelaySec=5min | |
Persistent=true | |
[Install] | |
WantedBy=timers.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment