|
|
|
@ -9,7 +9,7 @@ PROGRAM="osync" # Rsync based two way sync engine with fault tolerance
|
|
|
|
|
AUTHOR="(C) 2013-2018 by Orsiris de Jong"
|
|
|
|
|
CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr"
|
|
|
|
|
PROGRAM_VERSION=1.3.0-beta1
|
|
|
|
|
PROGRAM_BUILD=2018100202
|
|
|
|
|
PROGRAM_BUILD=2018100701
|
|
|
|
|
IS_STABLE=no
|
|
|
|
|
|
|
|
|
|
##### Execution order #__WITH_PARANOIA_DEBUG
|
|
|
|
@ -43,7 +43,7 @@ IS_STABLE=no
|
|
|
|
|
# CleanUp no #__WITH_PARANOIA_DEBUG
|
|
|
|
|
|
|
|
|
|
_OFUNCTIONS_VERSION=2.3.0-RC2
|
|
|
|
|
_OFUNCTIONS_BUILD=2018100205
|
|
|
|
|
_OFUNCTIONS_BUILD=2018100701
|
|
|
|
|
_OFUNCTIONS_BOOTSTRAP=true
|
|
|
|
|
|
|
|
|
|
if ! type "$BASH" > /dev/null; then
|
|
|
|
@ -161,7 +161,7 @@ function PoorMansRandomGenerator {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Initial TSTMAP value before function declaration
|
|
|
|
|
TSTAMP=$(date '+%Y%m%dT%H%M%S').$(PoorMansRandomGenerator 4)
|
|
|
|
|
TSTAMP=$(date '+%Y%m%dT%H%M%S').$(PoorMansRandomGenerator 5)
|
|
|
|
|
|
|
|
|
|
# Default alert attachment filename
|
|
|
|
|
ALERT_LOG_FILE="$RUN_DIR/$PROGRAM.$SCRIPT_PID.$TSTAMP.last.log"
|
|
|
|
@ -3546,13 +3546,11 @@ function timestampList {
|
|
|
|
|
function conflictList {
|
|
|
|
|
local timestampCurrentFilename="${1}" # filename of current timestamp list (will be prefixed with $replicaType)
|
|
|
|
|
local timestampAfterFilename="${2}" # filename of previous timestamp list (will be prefixed with $replicaType)
|
|
|
|
|
local conflictFilename="{3}" # filename of conflicts
|
|
|
|
|
|
|
|
|
|
__CheckArguments 3 $# "$@" #__WITH_PARANOIA_DEBUG
|
|
|
|
|
__CheckArguments 2 $# "$@" #__WITH_PARANOIA_DEBUG
|
|
|
|
|
|
|
|
|
|
local retval
|
|
|
|
|
local escapedReplicaPath
|
|
|
|
|
local rsyncCmd
|
|
|
|
|
|
|
|
|
|
if [ -f "${INITIATOR[$__replicaDir]}${INITIATOR[$__stateDir]}/${INITIATOR[$__type]}$timestampCurrentFilename" ] && [ -f "${INITIATOR[$__replicaDir]}${INITIATOR[$__stateDir]}/${TARGET[$__type]}$timestampCurrentFilename" ]; then
|
|
|
|
|
# Remove prepending replicaPaths
|
|
|
|
@ -4494,7 +4492,7 @@ function Sync {
|
|
|
|
|
## Step 3a & 3b
|
|
|
|
|
if [ "$resumeInitiator" == "${SYNC_ACTION[3]}" ] || [ "$resumeTarget" == "${SYNC_ACTION[3]}" ]; then
|
|
|
|
|
if [ "$LOG_CONFLICTS" == "yes" ]; then
|
|
|
|
|
conflictList "${INITIATOR[$__timestampCurrentFile]}" "${INITIATOR[$__timestampAfterFileNoSuffix]}" "${INITIATOR[$__conflictListFile]}" &
|
|
|
|
|
conflictList "${INITIATOR[$__timestampCurrentFile]}" "${INITIATOR[$__timestampAfterFileNoSuffix]}" &
|
|
|
|
|
ExecTasks $! "${FUNCNAME[0]}" false 0 0 $SOFT_MAX_EXEC_TIME $HARD_MAX_EXEC_TIME false $SLEEP_TIME $KEEP_LOGGING
|
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
|
echo "${SYNC_ACTION[3]}" > "${INITIATOR[$__initiatorLastActionFile]}"
|
|
|
|
@ -5220,6 +5218,7 @@ function LogConflicts {
|
|
|
|
|
if [ -f "$RUN_DIR/$PROGRAM.conflictList.compare.$SCRIPT_PID.$TSTAMP" ]; then
|
|
|
|
|
echo "" > "${INITIATOR[$__replicaDir]}${INITIATOR[$__stateDir]}/${INITIATOR[$__conflictListFile]}"
|
|
|
|
|
while read -r line; do
|
|
|
|
|
|
|
|
|
|
echo "${INITIATOR[$__replicaDir]}$(echo $line | awk -F';' '{print $1}') << >> ${TARGET[$__replicaDir]}$(echo $line | awk -F';' '{print $1}')" >> "${INITIATOR[$__replicaDir]}${INITIATOR[$__stateDir]}/${INITIATOR[$__conflictListFile]}"
|
|
|
|
|
done < "$RUN_DIR/$PROGRAM.conflictList.compare.$SCRIPT_PID.$TSTAMP"
|
|
|
|
|
|
|
|
|
|