Created
June 25, 2023 15:09
-
-
Save darcien/08e39028899614e458b9f95116d152bf to your computer and use it in GitHub Desktop.
justfile for restic backup, put this in home dir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set dotenv-load | |
export RESTIC_REPOSITORY := 'E:\restic-repo' | |
# This retrieve the pw from bitwarden vault. | |
# bw cli needs bw login and bw session key set in .env before used. | |
export RESTIC_PASSWORD := `bw get password "restic repo"` | |
# Restic docs | |
# https://restic.readthedocs.io/en/stable/index.html | |
default: | |
@just --list | |
# Backup my documents only | |
backup-docs: | |
restic --verbose backup "D:\Yosua\Documents" --exclude-file=excludes.txt | |
# Do all preconfigured backups | |
backup: | |
just backup-docs | |
# Remove old snapshots using policy based rule. Current policy: keep last 1 backup | |
forget *FLAGS: | |
restic forget --keep-last 1 {{FLAGS}} | |
# Dry run for snapshots removal | |
forget-dry: | |
just forget --dry-run | |
# Remove unreferenced data in repo after snapshots have been forgotten | |
prune: | |
restic prune | |
# Repo health check, do this after pruning | |
check: | |
restic check | |
# Repo stats like sizes | |
stats: | |
restic stats |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment