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

49 lines
1 KiB
Desktop File

[Unit]
Description=Restic Backup - Code Directory
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-code
Environment=RESTIC_PASSWORD_FILE=%h/.config/restic/password
Environment=RESTIC_CACHE_DIR=%h/.cache/restic
# Backup ~/Code
ExecStart=/usr/bin/restic backup \
--verbose=1 \
--tag=code \
--tag=auto \
--exclude=node_modules \
--exclude=.git/objects \
--exclude=dist \
--exclude=build \
--exclude=.next \
--exclude=target \
--exclude=__pycache__ \
--exclude=*.pyc \
--exclude=.venv \
--exclude=venv \
%h/Code
# Prune old backups (7 daily, 4 weekly, 3 monthly)
ExecStartPost=/usr/bin/restic forget \
--keep-daily=7 \
--keep-weekly=4 \
--keep-monthly=3 \
--tag=code \
--prune
# Nice and IO priority for background operation
Nice=10
IOSchedulingClass=idle
# Restart on failure
Restart=on-failure
RestartSec=5m
[Install]
WantedBy=multi-user.target