Skip to content

Instantly share code, notes, and snippets.

@1player
Created February 18, 2024 11:09
Show Gist options
  • Save 1player/1133d10afb3b2730ea141adb162474d1 to your computer and use it in GitHub Desktop.
Save 1player/1133d10afb3b2730ea141adb162474d1 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -euo pipefail
REPO=sftp:xxx@xxx.rsync.net:restic-home/
export RESTIC_CACHE_DIR=/var/cache/restic
restic -r $REPO --password-file=/etc/restic.key unlock
systemd-inhibit --what=shutdown:sleep --who="$0" --why=backup \
ionice --class 3 \
restic -r $REPO backup \
--password-file=/etc/restic.key \
--one-file-system \
--exclude-file=/etc/restic.exclude \
--exclude-file=/var/home/xxx/.restic.exclude \
/etc /var/home
systemd-inhibit --what=shutdown:sleep --who="$0" --why=prune \
ionice --class 3 \
restic -r $REPO forget \
--password-file=/etc/restic.key \
--keep-tag keep \
--keep-daily 7 \
--keep-weekly 4 \
--keep-monthly 3 \
--keep-yearly 2 \
--keep-last 7 \
--prune \
--host "$HOSTNAME"
# Check in with my healthchecks.io account
curl -fsS -m 10 --retry 5 -o /dev/null https://hc-ping.com/xxx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment