From 43917a15e8d8f5ac12d832fbaa6db8aa82470220 Mon Sep 17 00:00:00 2001 From: Vamist Date: Sat, 6 May 2023 11:05:12 +0100 Subject: [PATCH] [dev] Speed up incremental backups Using fd-find and cpz from fuc --- .env | 3 ++- justfile | 13 +++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.env b/.env index b29049c..0bfc95b 100644 --- a/.env +++ b/.env @@ -1,6 +1,7 @@ ORIGINAL_DIR=/home/oreo/Zomboid/Saves/Multiplayer/servertest/ -INCREMENT_DIR=./increments/ +INCREMENT_DIR=/home/oreo/increments/ RESCUE_DIR=./rescue FOLDER_KEY=./increment.key + #archive_dir= diff --git a/justfile b/justfile index db72e25..4e0f33f 100644 --- a/justfile +++ b/justfile @@ -11,16 +11,21 @@ startup: set -euxo pipefail time=`date +"%m_%d_%Y_%H:%M:%S"` mkdir -p $INCREMENT_DIR$time - rsync -a $ORIGINAL_DIR $INCREMENT_DIR$time/$time + cpz $ORIGINAL_DIR $INCREMENT_DIR$time/$time echo $time > $FOLDER_KEY - ls -t $INCREMENT_DIR | tail -n +6 | xargs -I{} rm -r $INCREMENT_DIR{} + ls -t $INCREMENT_DIR | tail -n +10 | xargs -I{} rm -r $INCREMENT_DIR{} increment: #!/usr/bin/env bash set -euxo pipefail time=`date +"%m_%d_%Y_%H:%M:%S"` folder=`cat $FOLDER_KEY` - find $ORIGINAL_DIR -mmin -5.5 -exec rsync -z {} $INCREMENT_DIR$folder/$time/ \; + cd $ORIGINAL_DIR && fdfind --changed-within "6m" --no-ignore -x cpz {} $INCREMENT_DIR$folder/$time/{} + @rescue folder time: - find $INCREMENT_DIR/$FOLDER ! -newermt "$TIME" -type f | sort -n | xargs -I{} rsync {} $RESCUE_DIR/ + find $INCREMENT_DIR/{{folder}} ! -newermt "{{time}}" -type f | sort -n | xargs -I{} rsync {} $RESCUE_DIR/ + +# fdfind --changed-before "2023-05-05 13:56:00" --no-ignore . ./increments/05_05_2023_11:30:59 | sort -n +@fast folder time: + fdfind --changed-before "{{time}}" --no-ignore . $INCREMENT_DIR/{{folder}} | sort -S 5% --parallel=4 -n | xargs -I {} cpz {} $RESCUE_DIR/ -- 2.45.2