platform-deployments/systemd/restic-backup-dotfiles.service

49 lines
1.2 KiB
Desktop File

[Unit]
Description=Restic Backup - Dotfiles
Documentation=https://restic.readthedocs.io/
After=network-online.target
Wants=network-online.target
[Service]
Type=oneshot
# Environment
Environment=RESTIC_REPOSITORY=rest:http://10.0.0.11:8000/%H-dotfiles
Environment=RESTIC_PASSWORD_FILE=%h/.config/restic/password
Environment=RESTIC_CACHE_DIR=%h/.cache/restic
# Backup dotfiles (exclude large cache directories)
ExecStart=/usr/bin/restic backup \
--verbose=1 \
--tag=dotfiles \
--tag=auto \
--exclude=.cache \
--exclude=.local/share/Trash \
--exclude=.npm \
--exclude=.pnpm-store \
--exclude=.cargo/registry \
--exclude=.rustup \
--exclude=.mozilla/firefox/*/Cache \
--exclude=.config/google-chrome/*/Cache \
--exclude=.config/Code/Cache \
--exclude=.config/Code/CachedData \
--files-from=%h/.config/restic/dotfiles-include.txt
# Prune old backups (7 daily, 4 weekly, 3 monthly)
ExecStartPost=/usr/bin/restic forget \
--keep-daily=7 \
--keep-weekly=4 \
--keep-monthly=3 \
--tag=dotfiles \
--prune
# Nice and IO priority for background operation
Nice=10
IOSchedulingClass=idle
# Restart on failure
Restart=on-failure
RestartSec=1h
[Install]
WantedBy=multi-user.target