dotfiles/bin/Restic-Backup.ps1

34 lines
671 B
PowerShell

#
# 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 }
}