From 79c57d1ebef81e37893ad55cd915977eb4e2c9f4 Mon Sep 17 00:00:00 2001 From: Bel LaPointe Date: Tue, 25 Jun 2019 09:32:18 -0600 Subject: [PATCH] has some prune --- sync.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/sync.sh b/sync.sh index 55f3b06..638678e 100644 --- a/sync.sh +++ b/sync.sh @@ -19,9 +19,10 @@ function main() { local action="$1" shift case "$action" in - backup ) backup "$@" ;; - restore ) restore "$@" ;; - * ) RESTIC "$action" "$@" ;; + clean ) clean_remote --prune "$@" ;; + backup ) backup "$@" ;; + restore ) restore "$@" ;; + * ) RESTIC "$action" "$@" ;; esac } @@ -85,8 +86,8 @@ function backup() { -e "**.sw*" \ --tag "${real#$HOME/}" \ $real - RESTIC forget --keep-last 2 --group-by host,tags #--prune done + clean_remote } function restore() { @@ -106,6 +107,11 @@ function restore() { mv $HOME/$path $HOME/$path-old mv $HOME/$path-restore $HOME/$path done + clean_remote --prune +} + +function clean_remote() { + RESTIC forget --keep-last 2 --group-by host,tags "$@" } function RCLONE() {