From f72d1366ff9766183e9212c6bae072dffe6358cf Mon Sep 17 00:00:00 2001 From: deajan Date: Sun, 30 Sep 2018 16:26:52 +0200 Subject: [PATCH] Always make delta copies on rotation, even in local mode --- dev/n_obackup.sh | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/dev/n_obackup.sh b/dev/n_obackup.sh index 5a3384b..8892408 100644 --- a/dev/n_obackup.sh +++ b/dev/n_obackup.sh @@ -7,7 +7,7 @@ PROGRAM="obackup" AUTHOR="(C) 2013-2018 by Orsiris de Jong" CONTACT="http://www.netpower.fr/obackup - ozy@netpower.fr" PROGRAM_VERSION=2.1-RC1 -PROGRAM_BUILD=2018093004 +PROGRAM_BUILD=2018093005 IS_STABLE=no #### Execution order #__WITH_PARANOIA_DEBUG @@ -1619,7 +1619,9 @@ function _RotateBackupsLocal { copy=$((copy-1)) done + # TODO: Describe new behavior: Always copy instead of move in order to make delta copies # Latest file backup will not be moved if script configured for remote backup so next rsync execution will only do delta copy instead of full one + # Whereas sql files will always be moved because we don't do deltas on sql files if [[ $backup == *.sql.* ]]; then cmd="mv \"$backup\" \"$backup.$PROGRAM.1\"" Logger "Launching command [$cmd]." "DEBUG" @@ -1627,28 +1629,29 @@ function _RotateBackupsLocal { ExecTasks $! "${FUNCNAME[0]}" false 0 0 3600 0 true $SLEEP_TIME $KEEP_LOGGING if [ $? -ne 0 ]; then Logger "Cannot move [$backup] to [$backup.$PROGRAM.1]." "ERROR" - _LOGGER_SILENT=true Logger "Command was [$cmd]." "WARN" + _LOGGER_SILENT=true Logger "Command was [$cmd]." "WARN" fi - elif [ "$REMOTE_OPERATION" == "yes" ]; then + else + #elif [ "$REMOTE_OPERATION" == "yes" ]; then cmd="cp -R \"$backup\" \"$backup.$PROGRAM.1\"" Logger "Launching command [$cmd]." "DEBUG" eval "$cmd" & ExecTasks $! "${FUNCNAME[0]}" false 0 0 3600 0 true $SLEEP_TIME $KEEP_LOGGING if [ $? -ne 0 ]; then Logger "Cannot copy [$backup] to [$backup.$PROGRAM.1]." "ERROR" - _LOGGER_SILENT=true Logger "Command was [$cmd]." "WARN" + _LOGGER_SILENT=true Logger "Command was [$cmd]." "WARN" fi - else - cmd="mv \"$backup\" \"$backup.$PROGRAM.1\"" - Logger "Launching command [$cmd]." "DEBUG" - eval "$cmd" & - ExecTasks $! "${FUNCNAME[0]}" false 0 0 3600 0 true $SLEEP_TIME $KEEP_LOGGING - if [ $? -ne 0 ]; then - Logger "Cannot move [$backup] to [$backup.$PROGRAM.1]." "ERROR" - _LOGGER_SILENT=true Logger "Command was [$cmd]." "WARN" - fi + #else + # cmd="mv \"$backup\" \"$backup.$PROGRAM.1\"" + # Logger "Launching command [$cmd]." "DEBUG" + # eval "$cmd" & + # ExecTasks $! "${FUNCNAME[0]}" false 0 0 3600 0 true $SLEEP_TIME $KEEP_LOGGING + # if [ $? -ne 0 ]; then + # Logger "Cannot move [$backup] to [$backup.$PROGRAM.1]." "ERROR" + # _LOGGER_SILENT=true Logger "Command was [$cmd]." "WARN" + # fi fi done }