Skip to content

Instantly share code, notes, and snippets.

@cuihaoleo
Created February 23, 2022 18:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cuihaoleo/1c3560edab0ab60734736f03609de4b0 to your computer and use it in GitHub Desktop.
Save cuihaoleo/1c3560edab0ab60734736f03609de4b0 to your computer and use it in GitHub Desktop.
[Unit]
Description=Backup data using restic
After=network-online.target
Wants=network-online.target
[Service]
User=root
Group=root
EnvironmentFile=/etc/systemd/%N.env
Type=oneshot
ExecStart=/usr/bin/restic backup /home /etc /var --exclude-if-present=.nobackup --exclude-caches --exclude-file=/etc/restic-exclude
ExecStartPost=/usr/bin/restic forget --keep-last 3 --keep-daily 7 --keep-weekly 5 --prune
[Unit]
Description=Run server backup daily
[Timer]
OnCalendar=daily
Persistent=true
[Install]
WantedBy=timers.target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment