New step verify (against profile settings only for now)
Enhanced step restore with more options
This commit is contained in:
@@ -16,6 +16,9 @@ EBU_TARGET=
|
|||||||
# base directory to backup
|
# base directory to backup
|
||||||
EBU_SOURCE=
|
EBU_SOURCE=
|
||||||
|
|
||||||
|
# Change the volume size to number MB. Default is 200MB.
|
||||||
|
#EBU_VOLSIZE=
|
||||||
|
|
||||||
# a command that runs duplicity e.g.
|
# a command that runs duplicity e.g.
|
||||||
# shape bandwidth use via trickle
|
# shape bandwidth use via trickle
|
||||||
# "trickle -s -u 640 -d 5120" # 5Mb up, 40Mb down"
|
# "trickle -s -u 640 -d 5120" # 5Mb up, 40Mb down"
|
||||||
|
@@ -40,7 +40,6 @@ step_1() {
|
|||||||
|
|
||||||
local arg
|
local arg
|
||||||
local dupArgs
|
local dupArgs
|
||||||
local dupCommand
|
|
||||||
local purgeAfter=1
|
local purgeAfter=1
|
||||||
|
|
||||||
for arg in "$@" ; do
|
for arg in "$@" ; do
|
||||||
@@ -58,7 +57,7 @@ step_1() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -z "$1" ] && ( [ "$1" == "full" ] || [ "$1" == "incremental" ] ) ; then
|
if [ ! -z "$1" ] && ( [ "$1" == "full" ] || [ "$1" == "incremental" ] ) ; then
|
||||||
dupCommand="$1"
|
dupArgs+=("$1")
|
||||||
elif [ ! -z "$1" ] ; then
|
elif [ ! -z "$1" ] ; then
|
||||||
echo " [W] $toolName command \"$1\" not recognized"
|
echo " [W] $toolName command \"$1\" not recognized"
|
||||||
return -1
|
return -1
|
||||||
@@ -66,13 +65,16 @@ step_1() {
|
|||||||
|
|
||||||
echo " [I] Running backup profile [$SEQ_PROFILE_NAME]"
|
echo " [I] Running backup profile [$SEQ_PROFILE_NAME]"
|
||||||
|
|
||||||
if [ "$dupCommand" != "full" ] && [ ! -z "$EBU_MAX_FULLBKP_AGE" ] ; then
|
if [ "${dupArgs[0]}" != "full" ] && [ ! -z "$EBU_MAX_FULLBKP_AGE" ] ; then
|
||||||
dupArgs+="--full-if-older-than=$EBU_MAX_FULLBKP_AGE "
|
dupArgs+=(--full-if-older-than "$EBU_MAX_FULLBKP_AGE")
|
||||||
|
fi
|
||||||
|
if [ ! -z "$EBU_VOLSIZE" ] ; then
|
||||||
|
dupArgs+=(--volsize "$EBU_VOLSIZE")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
checkInstalled
|
checkInstalled
|
||||||
setPassphrase
|
setPassphrase
|
||||||
exe $toolBin $dupCommand $dupArgs "$EBU_SOURCE" "$EBU_TARGET"
|
exe $toolBin "${dupArgs[@]}" "$EBU_SOURCE" "$EBU_TARGET"
|
||||||
unsetPassphrase
|
unsetPassphrase
|
||||||
|
|
||||||
if [ $purgeAfter -ne 0 ] ; then
|
if [ $purgeAfter -ne 0 ] ; then
|
||||||
@@ -80,10 +82,51 @@ step_1() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
step_3_info() { echo "Restore <LOCAL TARGET> [TARGET]"; }
|
step_3_info() { echo "Verify selected backup"; }
|
||||||
step_3_alias() { ALIAS="restore"; }
|
step_3_alias() { ALIAS="verify"; }
|
||||||
step_3() {
|
step_3() {
|
||||||
shift
|
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] <LOCAL TARGET> [TARGET]"
|
||||||
|
echoinfo " [OPTIONS]"
|
||||||
|
echoinfo " --file-to-restore, -f <RELPATH> : Relative path within backup"
|
||||||
|
echoinfo " (file or folder)"
|
||||||
|
echoinfo " --time, -t <TIME> : Age of file to be restored"
|
||||||
|
}
|
||||||
|
step_5_alias() { ALIAS="restore"; }
|
||||||
|
step_5() {
|
||||||
|
shift
|
||||||
|
|
||||||
|
local arg
|
||||||
|
local restoreOpt
|
||||||
|
|
||||||
|
for arg in "$@" ; do
|
||||||
|
case "$1" in
|
||||||
|
--file-to-restore|-f)
|
||||||
|
shift
|
||||||
|
restoreOpt+=(--file-to-restore "$1")
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
--time|-t)
|
||||||
|
shift
|
||||||
|
restoreOpt=(-t "$1")
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
if [ -z "$1" ] ; then
|
if [ -z "$1" ] ; then
|
||||||
echoerr " [E] No target provided"
|
echoerr " [E] No target provided"
|
||||||
return -1
|
return -1
|
||||||
@@ -96,13 +139,13 @@ step_3() {
|
|||||||
|
|
||||||
checkInstalled
|
checkInstalled
|
||||||
setPassphrase
|
setPassphrase
|
||||||
exe $toolBin restore "$EBU_TARGET" "$ebuLocalTarget"
|
exe $toolBin restore "${restoreOpt[@]}" "$EBU_TARGET" "$ebuLocalTarget"
|
||||||
unsetPassphrase
|
unsetPassphrase
|
||||||
}
|
}
|
||||||
|
|
||||||
step_5_info() { echo "Purge old backups [TARGET]"; }
|
step_7_info() { echo "Purge old backups [TARGET]"; }
|
||||||
step_5_alias() { ALIAS="purge"; }
|
step_7_alias() { ALIAS="purge"; }
|
||||||
step_5() {
|
step_7() {
|
||||||
shift
|
shift
|
||||||
local ebuTarget="$EBU_TARGET"
|
local ebuTarget="$EBU_TARGET"
|
||||||
local dupCommand=
|
local dupCommand=
|
||||||
|
Reference in New Issue
Block a user