From 3c0f0b542d793e68c4b0991ac58b2bc0400cc490 Mon Sep 17 00:00:00 2001 From: deajan Date: Mon, 29 Jun 2020 09:24:06 +0100 Subject: [PATCH] Tidy up conflict log messages --- dev/n_osync.sh | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/dev/n_osync.sh b/dev/n_osync.sh index 6521af6..10e7726 100644 --- a/dev/n_osync.sh +++ b/dev/n_osync.sh @@ -7,8 +7,8 @@ PROGRAM="osync" # Rsync based two way sync engine with fault tolerance AUTHOR="(C) 2013-2020 by Orsiris de Jong" CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr" PROGRAM_VERSION=1.3.0-rc1 -PROGRAM_BUILD=2020050302 -IS_STABLE=false +PROGRAM_BUILD=2020062901 +IS_STABLE=true CONFIG_FILE_REVISION_REQUIRED=1.3.0 @@ -2510,7 +2510,7 @@ function LogConflicts { local conflicts=0 - if [ -f "$RUN_DIR/$PROGRAM.conflictList.compare.$SCRIPT_PID.$TSTAMP" ]; then + if [ -s "$RUN_DIR/$PROGRAM.conflictList.compare.$SCRIPT_PID.$TSTAMP" ]; then Logger "File conflicts: INITIATOR << >> TARGET" "ALWAYS" > "${INITIATOR[$__replicaDir]}${INITIATOR[$__stateDir]}/${INITIATOR[$__conflictListFile]}" while read -r line; do @@ -2518,10 +2518,12 @@ function LogConflicts { conflicts=$((conflicts+1)) done < "$RUN_DIR/$PROGRAM.conflictList.compare.$SCRIPT_PID.$TSTAMP" - ( - _LOGGER_PREFIX="" - Logger "Truncated output:\n$(head -c16384 "${INITIATOR[$__replicaDir]}${INITIATOR[$__stateDir]}/${INITIATOR[$__conflictListFile]}")" "ALWAYS" - ) + if [ -s "${INITIATOR[$__replicaDir]}${INITIATOR[$__stateDir]}/${INITIATOR[$__conflictListFile]}" ]; then + ( + _LOGGER_PREFIX="" + Logger "Truncated output:\n$(head -c16384 "${INITIATOR[$__replicaDir]}${INITIATOR[$__stateDir]}/${INITIATOR[$__conflictListFile]}")" "ALWAYS" + ) + fi Logger "There are $conflicts conflictual files." "ALWAYS" else