From ae8dc0edd0cfe765bac54a73956ecf7e4b21ab1d Mon Sep 17 00:00:00 2001 From: Matan Horovitz Date: Mon, 31 Jan 2022 19:09:05 +0200 Subject: [PATCH] Pruning attempts continue; snapshot logging fix --- Kumonoboru | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Kumonoboru b/Kumonoboru index c1de0c7..da34eb0 100755 --- a/Kumonoboru +++ b/Kumonoboru @@ -89,7 +89,7 @@ backup(){ if safety "$REPOSITORY"; then #Run the backup info "Backing up repository $REPOSITORY" - if restic -r b2:"$REPOSITORY" backup "$REPOSITORY_PATH" --limit-upload="$BWLIMIT" --limit-download="$BWLIMIT"; then + if restic -r b2:"$REPOSITORY" backup "$REPOSITORY_PATH" --limit-upload="$BWLIMIT" --limit-download="$BWLIMIT" | tee -a $LOG; then ok "Path $REPOSITORY_PATH completed upload to $REPOSITORY." check "$REPOSITORY" else @@ -100,6 +100,7 @@ backup(){ check(){ REPOSITORY="$1" PRUNE="$2" + debug "Working on Repostory $1 with prune option $2" ## ^ This variable will have value if repo is already clean, indicating #+ This is a post backup check. if [[ -n $PRUNE ]]; then @@ -107,13 +108,12 @@ check(){ fi if safety "$REPOSITORY"; then info "Checking repository $REPOSITORY" - if restic -r b2:"$REPOSITORY" check --limit-upload="$BWLIMIT" --limit-download="$BWLIMIT"; then + if restic -r b2:"$REPOSITORY" check --limit-upload="$BWLIMIT" --limit-download="$BWLIMIT" | tee -a $LOG; then ok "Repository $REPOSITORY passed integrity check!" info "Current snapshots:" - restic -r b2:"$REPOSITORY" snapshots >> $LOG - if [[ -z $PRUNE ]] && [[ $(date +%d) == "18" ]]; then -#Only clean the repository if ^not done already ^ and today is the 18th of the month (prune monthly) - info "Monthly prune is today; cleaning $REPOSITORY" + restic -r b2:"$REPOSITORY" snapshots | tee -a $LOG + if [[ -n $PRUNE ]]; then + info "prune is called for; cleaning $REPOSITORY" clean "$REPOSITORY" fi else @@ -125,7 +125,7 @@ clean(){ REPOSITORY="$1" if safety "$REPOSITORY"; then info "Cleaning repository $REPOSITORY" - if restic -r b2:$REPOSITORY forget --keep-daily 7 --keep-weekly 4 --keep-monthly 12 --prune --limit-upload="$BWLIMIT" --limit-download="$BWLIMIT"; then + if restic -r b2:$REPOSITORY forget --keep-daily 7 --keep-weekly 4 --keep-monthly 12 --prune --limit-upload="$BWLIMIT" --limit-download="$BWLIMIT" | tee -a $LOG; then ok "Repository $REPOSITORY is trim!" debug "Running post clean check..." check "$REPOSITORY" "1" @@ -171,7 +171,7 @@ elif [[ -n $REPOSITORY ]] && [[ -n $CLEAN ]]; then help;; esac #If cleaning was forced and no repository specified, clean all repositories -elif [[ -n $CLEAN ]]; then +elif [[ -n $CLEAN ]] || [[ $(date +%a) == "Friday" ]]; then clean Gerbil-TK clean Pukeko-XYZ-Containers clean Pukeko-XYZ-Cloud