Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env bash
- #set backblaze b2 accout credentials
- export B2_ACCOUNT_ID="b2AccountID"
- export B2_ACCOUNT_KEY="b2AccountKey"
- export RESTIC_PASSWORD="resticRepoPassword"
- #set restic bucket repo
- export RESTIC_REPOSITORY="b2:resticRepo"
- #backup Home directory excluding any unwanted directories
- #script will not backup Downloads
- #script backs all home directory
- restic backup --exclude=~/Downloads ~
- #check data is correctly in repo
- #
- restic check >> /file/to/write/log.txt
- restic snapshots >> /file/to/write/log.txt
- #Remove old repos based on backup strategy
- restic forget \
- --keep-hourly 4 \
- --keep-daily 7 \
- --keep-weekly 4 \
- --keep-monthly 6 \
- >> /file/to/write/log.txt
- #Delete removed snapshots
- restic prune >> /file/to/write/log.txt
- #Route the normal process logging to journalctl
- 2>&1
- #reset b2 credentials
- export B2_ACCOUNT_ID =""
- export B2_ACCOUNT_KEY=""
- export RESTIC_PASSWORD=""
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement