From 213180013ada38da092e29a9afa9e61827423926 Mon Sep 17 00:00:00 2001 From: Martin Winkler Date: Wed, 3 Feb 2021 23:53:46 +0100 Subject: [PATCH] New step verify (against profile settings only for now) Enhanced step restore with more options --- seqs/ebackup.cfg.example | 3 ++ seqs/ebackup.sh | 65 +++++++++++++++++++++++++++++++++------- 2 files changed, 57 insertions(+), 11 deletions(-) diff --git a/seqs/ebackup.cfg.example b/seqs/ebackup.cfg.example index a786311..92db483 100644 --- a/seqs/ebackup.cfg.example +++ b/seqs/ebackup.cfg.example @@ -16,6 +16,9 @@ EBU_TARGET= # base directory to backup EBU_SOURCE= +# Change the volume size to number MB. Default is 200MB. +#EBU_VOLSIZE= + # a command that runs duplicity e.g. # shape bandwidth use via trickle # "trickle -s -u 640 -d 5120" # 5Mb up, 40Mb down" diff --git a/seqs/ebackup.sh b/seqs/ebackup.sh index 818c5a3..6a4af0a 100755 --- a/seqs/ebackup.sh +++ b/seqs/ebackup.sh @@ -40,7 +40,6 @@ step_1() { local arg local dupArgs - local dupCommand local purgeAfter=1 for arg in "$@" ; do @@ -58,7 +57,7 @@ step_1() { fi if [ ! -z "$1" ] && ( [ "$1" == "full" ] || [ "$1" == "incremental" ] ) ; then - dupCommand="$1" + dupArgs+=("$1") elif [ ! -z "$1" ] ; then echo " [W] $toolName command \"$1\" not recognized" return -1 @@ -66,13 +65,16 @@ step_1() { echo " [I] Running backup profile [$SEQ_PROFILE_NAME]" - if [ "$dupCommand" != "full" ] && [ ! -z "$EBU_MAX_FULLBKP_AGE" ] ; then - dupArgs+="--full-if-older-than=$EBU_MAX_FULLBKP_AGE " + if [ "${dupArgs[0]}" != "full" ] && [ ! -z "$EBU_MAX_FULLBKP_AGE" ] ; then + dupArgs+=(--full-if-older-than "$EBU_MAX_FULLBKP_AGE") + fi + if [ ! -z "$EBU_VOLSIZE" ] ; then + dupArgs+=(--volsize "$EBU_VOLSIZE") fi checkInstalled setPassphrase - exe $toolBin $dupCommand $dupArgs "$EBU_SOURCE" "$EBU_TARGET" + exe $toolBin "${dupArgs[@]}" "$EBU_SOURCE" "$EBU_TARGET" unsetPassphrase if [ $purgeAfter -ne 0 ] ; then @@ -80,10 +82,51 @@ step_1() { fi } -step_3_info() { echo "Restore [TARGET]"; } -step_3_alias() { ALIAS="restore"; } +step_3_info() { echo "Verify selected backup"; } +step_3_alias() { ALIAS="verify"; } step_3() { shift + + if [ -z $EBU_TARGET ] || [ -z $EBU_SOURCE ] ; then + echo " [I] Nothing to do. Check $SEQ_CONFIG_FILE" + return -1 + fi + + checkInstalled + setPassphrase + exe $toolBin verify "$EBU_TARGET" "$EBU_SOURCE" + unsetPassphrase +} + +step_5_info() { + echo "Restore [OPTIONS] [TARGET]" + echoinfo " [OPTIONS]" + echoinfo " --file-to-restore, -f : Relative path within backup" + echoinfo " (file or folder)" + echoinfo " --time, -t