From 385d3cae432c2d0afdd17d6c7b5780a2d1a627be Mon Sep 17 00:00:00 2001 From: Heavy Date: Sun, 2 Mar 2025 22:08:07 +0100 Subject: [PATCH] (restic): Add powershell script for restic backup. --- bin/Restic-Backup.ps1 | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 bin/Restic-Backup.ps1 diff --git a/bin/Restic-Backup.ps1 b/bin/Restic-Backup.ps1 new file mode 100644 index 0000000..b659e70 --- /dev/null +++ b/bin/Restic-Backup.ps1 @@ -0,0 +1,33 @@ +# +# Create a Restic Backup +# + +param ( $action = "list" ) + +$env:RESTIC_REPOSITORY = "sftp:storagebox:/home/imac/restic" +$env:RESTIC_PASSWORD_FILE = "$PSScriptroot\restic-repo.txt" +Write-Host "Running in $PSScriptRoot with repo $env:RESTIC_REPOSITORY" + +function backup +{ + + restic backup -v --tag CarbonHome --exclude-caches --exclude-file="$PSScriptRoot\restic-exclude.txt" c:/Users/Heavy +} + +function forget +{ + restic --keep-daily 2 --keep-weekly 2 --keep-monthly 5 +} + +function list() +{ + restic ls latest +} + +switch($action) { + "backup" { backup } + "forget" { forget } + "list" { list } + "snapshots" { restic snapshots } + "stats" { restic stats } +}