Rebuilt targets
This commit is contained in:
parent
5857d8200b
commit
fad217447d
|
@ -7,7 +7,7 @@ PROGRAM="osync" # Rsync based two way sync engine with fault tolerance
|
||||||
AUTHOR="(C) 2013-2018 by Orsiris de Jong"
|
AUTHOR="(C) 2013-2018 by Orsiris de Jong"
|
||||||
CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr"
|
CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr"
|
||||||
PROGRAM_VERSION=1.3.0-beta1
|
PROGRAM_VERSION=1.3.0-beta1
|
||||||
PROGRAM_BUILD=2018101701
|
PROGRAM_BUILD=2018101801
|
||||||
IS_STABLE=no
|
IS_STABLE=no
|
||||||
|
|
||||||
##### Execution order #__WITH_PARANOIA_DEBUG
|
##### Execution order #__WITH_PARANOIA_DEBUG
|
||||||
|
@ -41,7 +41,7 @@ IS_STABLE=no
|
||||||
# CleanUp no #__WITH_PARANOIA_DEBUG
|
# CleanUp no #__WITH_PARANOIA_DEBUG
|
||||||
|
|
||||||
_OFUNCTIONS_VERSION=2.3.0-RC2
|
_OFUNCTIONS_VERSION=2.3.0-RC2
|
||||||
_OFUNCTIONS_BUILD=2018101701
|
_OFUNCTIONS_BUILD=2018110502
|
||||||
_OFUNCTIONS_BOOTSTRAP=true
|
_OFUNCTIONS_BOOTSTRAP=true
|
||||||
|
|
||||||
if ! type "$BASH" > /dev/null; then
|
if ! type "$BASH" > /dev/null; then
|
||||||
|
@ -1090,7 +1090,7 @@ function ExecTasks {
|
||||||
# Check for valid exit codes
|
# Check for valid exit codes
|
||||||
if [ $(ArrayContains $retval "${validExitCodes[@]}") -eq 0 ]; then
|
if [ $(ArrayContains $retval "${validExitCodes[@]}") -eq 0 ]; then
|
||||||
if [ $noErrorLogsAtAll != true ]; then
|
if [ $noErrorLogsAtAll != true ]; then
|
||||||
Logger "${FUNCNAME[0]} called by [$id] finished monitoring pid [$pid] with exitcode [$retval]." "DEBUG"
|
Logger "${FUNCNAME[0]} called by [$id] finished monitoring pid [$pid] with exitcode [$retval]." "ERROR"
|
||||||
if [ "$functionMode" == "ParallelExec" ]; then
|
if [ "$functionMode" == "ParallelExec" ]; then
|
||||||
Logger "Command was [${commandsArrayPid[$pid]}]." "ERROR"
|
Logger "Command was [${commandsArrayPid[$pid]}]." "ERROR"
|
||||||
fi
|
fi
|
||||||
|
@ -1431,6 +1431,8 @@ function GetLocalOS {
|
||||||
# There is no good way to tell if currently running in BusyBox shell. Using sluggish way.
|
# There is no good way to tell if currently running in BusyBox shell. Using sluggish way.
|
||||||
if ls --help 2>&1 | grep -i "BusyBox" > /dev/null; then
|
if ls --help 2>&1 | grep -i "BusyBox" > /dev/null; then
|
||||||
localOsVar="BusyBox"
|
localOsVar="BusyBox"
|
||||||
|
elif set -o | grep "winxp" > /dev/null; then
|
||||||
|
localOsVar="BusyBox-w32"
|
||||||
else
|
else
|
||||||
# Detecting the special ubuntu userland in Windows 10 bash
|
# Detecting the special ubuntu userland in Windows 10 bash
|
||||||
if grep -i Microsoft /proc/sys/kernel/osrelease > /dev/null 2>&1; then
|
if grep -i Microsoft /proc/sys/kernel/osrelease > /dev/null 2>&1; then
|
||||||
|
@ -1463,7 +1465,7 @@ function GetLocalOS {
|
||||||
*"CYGWIN"*)
|
*"CYGWIN"*)
|
||||||
LOCAL_OS="Cygwin"
|
LOCAL_OS="Cygwin"
|
||||||
;;
|
;;
|
||||||
*"Microsoft"*)
|
*"Microsoft"*|*"MS/Windows"*)
|
||||||
LOCAL_OS="WinNT10"
|
LOCAL_OS="WinNT10"
|
||||||
;;
|
;;
|
||||||
*"Darwin"*)
|
*"Darwin"*)
|
||||||
|
@ -1494,7 +1496,8 @@ function GetLocalOS {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get Host info for Windows
|
# Get Host info for Windows
|
||||||
if [ "$LOCAL_OS" == "msys" ] || [ "$LOCAL_OS" == "BusyBox" ] || [ "$LOCAL_OS" == "Cygwin" ] || [ "$LOCAL_OS" == "WinNT10" ]; then localOsVar="$(uname -a)"
|
if [ "$LOCAL_OS" == "msys" ] || [ "$LOCAL_OS" == "BusyBox" ] || [ "$LOCAL_OS" == "Cygwin" ] || [ "$LOCAL_OS" == "WinNT10" ]; then
|
||||||
|
localOsVar="$localOsVar $(uname -a)"
|
||||||
if [ "$PROGRAMW6432" != "" ]; then
|
if [ "$PROGRAMW6432" != "" ]; then
|
||||||
LOCAL_OS_BITNESS=64
|
LOCAL_OS_BITNESS=64
|
||||||
LOCAL_OS_FAMILY="Windows"
|
LOCAL_OS_FAMILY="Windows"
|
||||||
|
@ -1508,6 +1511,9 @@ function GetLocalOS {
|
||||||
# Get Host info for Unix
|
# Get Host info for Unix
|
||||||
else
|
else
|
||||||
LOCAL_OS_FAMILY="Unix"
|
LOCAL_OS_FAMILY="Unix"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$LOCAL_OS_FAMILY" == "Unix" ]; then
|
||||||
if uname -m | grep '64' > /dev/null 2>&1; then
|
if uname -m | grep '64' > /dev/null 2>&1; then
|
||||||
LOCAL_OS_BITNESS=64
|
LOCAL_OS_BITNESS=64
|
||||||
else
|
else
|
||||||
|
@ -2124,14 +2130,14 @@ function InitLocalOSDependingSettings {
|
||||||
function InitRemoteOSDependingSettings {
|
function InitRemoteOSDependingSettings {
|
||||||
__CheckArguments 0 $# "$@" #__WITH_PARANOIA_DEBUG
|
__CheckArguments 0 $# "$@" #__WITH_PARANOIA_DEBUG
|
||||||
|
|
||||||
if [ "$REMOTE_OS" == "msys" ] || [ "$LOCAL_OS" == "Cygwin" ]; then
|
if [ "$REMOTE_OS" == "msys" ] || [ "$REMOTE_OS" == "Cygwin" ]; then
|
||||||
REMOTE_FIND_CMD=$(dirname $BASH)/find
|
REMOTE_FIND_CMD=$(dirname $BASH)/find
|
||||||
else
|
else
|
||||||
REMOTE_FIND_CMD=find
|
REMOTE_FIND_CMD=find
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## Stat command has different syntax on Linux and FreeBSD/MacOSX
|
## Stat command has different syntax on Linux and FreeBSD/MacOSX
|
||||||
if [ "$LOCAL_OS" == "MacOSX" ] || [ "$LOCAL_OS" == "BSD" ]; then
|
if [ "$REMOTE_OS" == "MacOSX" ] || [ "$REMOTE_OS" == "BSD" ]; then
|
||||||
REMOTE_STAT_CMD="stat -f \"%Sm\""
|
REMOTE_STAT_CMD="stat -f \"%Sm\""
|
||||||
REMOTE_STAT_CTIME_MTIME_CMD="stat -f \\\"%N;%c;%m\\\""
|
REMOTE_STAT_CTIME_MTIME_CMD="stat -f \\\"%N;%c;%m\\\""
|
||||||
else
|
else
|
||||||
|
@ -2310,13 +2316,26 @@ function SetConfFileValue () {
|
||||||
local value="${3}"
|
local value="${3}"
|
||||||
local separator="${4:-#}"
|
local separator="${4:-#}"
|
||||||
|
|
||||||
if grep "^$name=" "$file" > /dev/null; then
|
if [ -f "$file" ]; then
|
||||||
# Using -i.tmp for BSD compat
|
if grep "^$name=" "$file" > /dev/null 2>&1; then
|
||||||
sed -i.tmp "s$separator^$name=.*$separator$name=$value$separator" "$file"
|
# Using -i.tmp for BSD compat
|
||||||
rm -f "$file.tmp"
|
sed -i.tmp "s$separator^$name=.*$separator$name=$value$separator" "$file"
|
||||||
Logger "Set [$name] to [$value] in config file [$file]." "DEBUG"
|
if [ $? -ne 0 ]; then
|
||||||
|
Logger "Cannot update value [$name] to [$value] in config file [$file]." "ERROR"
|
||||||
|
fi
|
||||||
|
rm -f "$file.tmp"
|
||||||
|
Logger "Set [$name] to [$value] in config file [$file]." "DEBUG"
|
||||||
|
else
|
||||||
|
echo "$name=$value" >> "$file"
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
Logger "Cannot create value [$name] to [$value] in config file [$file]." "ERROR"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
Logger "Cannot set value [$name] to [$value] in config file [$file]." "ERROR"
|
echo "$name=$value" > "$file"
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
Logger "Config file [$file] does not exist. Failed to create it witn value [$name]." "ERROR"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3524,16 +3543,16 @@ function _getFileCtimeMtimeLocal {
|
||||||
echo -n "" > "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$replicaType.$SCRIPT_PID.$TSTAMP"
|
echo -n "" > "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$replicaType.$SCRIPT_PID.$TSTAMP"
|
||||||
|
|
||||||
while IFS='' read -r file; do
|
while IFS='' read -r file; do
|
||||||
$STAT_CTIME_MTIME_CMD "$replicaPath$file" >> "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$replicaType.$SCRIPT_PID.$TSTAMP"
|
$STAT_CTIME_MTIME_CMD "$replicaPath$file" >> "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$replicaType.$SCRIPT_PID.$TSTAMP" 2> "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$replicaType.error.$SCRIPT_PID.$TSTAMP"
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
Logger "Could not get file attributes for [$replicaPath$file]." "ERROR"
|
Logger "Could not get file attributes for [$replicaPath$file]." "ERROR"
|
||||||
echo "1" > "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.subshellError.$replicaType.$SCRIPT_PID.$TSTAMP"
|
echo "1" > "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.subshellError.$replicaType.$SCRIPT_PID.$TSTAMP"
|
||||||
fi
|
fi
|
||||||
done < "$fileList"
|
done < "$fileList"
|
||||||
if [ -f "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.subshellError.$replicaType.$SCRIPT_PID.$TSTAMP" ]; then
|
if [ -f "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.subshellError.$replicaType.$SCRIPT_PID.$TSTAMP" ]; then
|
||||||
Logger "Getting file attributes failed [$retval] on $replicaType. Stopping execution." "CRITICAL" $retval
|
Logger "Getting file time attributes failed [$retval] on $replicaType. Stopping execution." "CRITICAL" $retval
|
||||||
if [ -s "$RUN_DIR/$PROGRAM.ctime_mtime.$replicaType.$SCRIPT_PID.$TSTAMP" ]; then #WIP: does this file exist
|
if [ -s "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$replicaType.error.$SCRIPT_PID.$TSTAMP" ]; then
|
||||||
Logger "Command output:\n$(cat $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$replicaType.$SCRIPT_PID.$TSTAMP)" "WARN"
|
Logger "Command output:\n$(cat "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$replicaType.error.$SCRIPT_PID.$TSTAMP")" "WARN"
|
||||||
fi
|
fi
|
||||||
return 1
|
return 1
|
||||||
else
|
else
|
||||||
|
@ -5726,23 +5745,21 @@ function LogConflicts {
|
||||||
local subject
|
local subject
|
||||||
local body
|
local body
|
||||||
|
|
||||||
# We keep this in a separate if check because of the subshell used for Logger with _LOGGER_PREFIX
|
|
||||||
if [ -f "$RUN_DIR/$PROGRAM.conflictList.compare.$SCRIPT_PID.$TSTAMP" ]; then
|
if [ -f "$RUN_DIR/$PROGRAM.conflictList.compare.$SCRIPT_PID.$TSTAMP" ]; then
|
||||||
Logger "File conflicts: INITIATOR << >> TARGET" "ALWAYS"
|
Logger "File conflicts: INITIATOR << >> TARGET" "ALWAYS"
|
||||||
fi
|
> "${INITIATOR[$__replicaDir]}${INITIATOR[$__stateDir]}/${INITIATOR[$__conflictListFile]}"
|
||||||
|
|
||||||
|
|
||||||
_LOGGER_PREFIX=""
|
|
||||||
(
|
|
||||||
if [ -f "$RUN_DIR/$PROGRAM.conflictList.compare.$SCRIPT_PID.$TSTAMP" ]; then
|
|
||||||
echo "" > "${INITIATOR[$__replicaDir]}${INITIATOR[$__stateDir]}/${INITIATOR[$__conflictListFile]}"
|
|
||||||
while read -r line; do
|
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]}"
|
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"
|
done < "$RUN_DIR/$PROGRAM.conflictList.compare.$SCRIPT_PID.$TSTAMP"
|
||||||
|
|
||||||
|
(
|
||||||
|
_LOGGER_PREFIX=""
|
||||||
Logger "$(cat ${INITIATOR[$__replicaDir]}${INITIATOR[$__stateDir]}/${INITIATOR[$__conflictListFile]})" "ALWAYS"
|
Logger "$(cat ${INITIATOR[$__replicaDir]}${INITIATOR[$__stateDir]}/${INITIATOR[$__conflictListFile]})" "ALWAYS"
|
||||||
|
)
|
||||||
|
else
|
||||||
|
Logger "No conflictList file." "ERROR"
|
||||||
fi
|
fi
|
||||||
)
|
|
||||||
if [ "$ALERT_CONFLICTS" == "yes" ] && [ -s "$RUN_DIR/$PROGRAM.conflictList.compare.$SCRIPT_PID.$TSTAMP" ]; then
|
if [ "$ALERT_CONFLICTS" == "yes" ] && [ -s "$RUN_DIR/$PROGRAM.conflictList.compare.$SCRIPT_PID.$TSTAMP" ]; then
|
||||||
subject="Conflictual files found in [$INSTANCE_ID]"
|
subject="Conflictual files found in [$INSTANCE_ID]"
|
||||||
body="List of conflictual files:"$'\n'"$(cat ${INITIATOR[$__replicaDir]}${INITIATOR[$__stateDir]}/${INITIATOR[$__conflictListFile]})"
|
body="List of conflictual files:"$'\n'"$(cat ${INITIATOR[$__replicaDir]}${INITIATOR[$__stateDir]}/${INITIATOR[$__conflictListFile]})"
|
||||||
|
|
12
install.sh
12
install.sh
|
@ -18,7 +18,7 @@ INSTANCE_ID="installer-$SCRIPT_BUILD"
|
||||||
## Please adapt this to fit your distro needs
|
## Please adapt this to fit your distro needs
|
||||||
|
|
||||||
_OFUNCTIONS_VERSION=2.3.0-RC2
|
_OFUNCTIONS_VERSION=2.3.0-RC2
|
||||||
_OFUNCTIONS_BUILD=2018101701
|
_OFUNCTIONS_BUILD=2018110502
|
||||||
_OFUNCTIONS_BOOTSTRAP=true
|
_OFUNCTIONS_BOOTSTRAP=true
|
||||||
|
|
||||||
if ! type "$BASH" > /dev/null; then
|
if ! type "$BASH" > /dev/null; then
|
||||||
|
@ -527,6 +527,8 @@ function GetLocalOS {
|
||||||
# There is no good way to tell if currently running in BusyBox shell. Using sluggish way.
|
# There is no good way to tell if currently running in BusyBox shell. Using sluggish way.
|
||||||
if ls --help 2>&1 | grep -i "BusyBox" > /dev/null; then
|
if ls --help 2>&1 | grep -i "BusyBox" > /dev/null; then
|
||||||
localOsVar="BusyBox"
|
localOsVar="BusyBox"
|
||||||
|
elif set -o | grep "winxp" > /dev/null; then
|
||||||
|
localOsVar="BusyBox-w32"
|
||||||
else
|
else
|
||||||
# Detecting the special ubuntu userland in Windows 10 bash
|
# Detecting the special ubuntu userland in Windows 10 bash
|
||||||
if grep -i Microsoft /proc/sys/kernel/osrelease > /dev/null 2>&1; then
|
if grep -i Microsoft /proc/sys/kernel/osrelease > /dev/null 2>&1; then
|
||||||
|
@ -559,7 +561,7 @@ function GetLocalOS {
|
||||||
*"CYGWIN"*)
|
*"CYGWIN"*)
|
||||||
LOCAL_OS="Cygwin"
|
LOCAL_OS="Cygwin"
|
||||||
;;
|
;;
|
||||||
*"Microsoft"*)
|
*"Microsoft"*|*"MS/Windows"*)
|
||||||
LOCAL_OS="WinNT10"
|
LOCAL_OS="WinNT10"
|
||||||
;;
|
;;
|
||||||
*"Darwin"*)
|
*"Darwin"*)
|
||||||
|
@ -590,7 +592,8 @@ function GetLocalOS {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get Host info for Windows
|
# Get Host info for Windows
|
||||||
if [ "$LOCAL_OS" == "msys" ] || [ "$LOCAL_OS" == "BusyBox" ] || [ "$LOCAL_OS" == "Cygwin" ] || [ "$LOCAL_OS" == "WinNT10" ]; then localOsVar="$(uname -a)"
|
if [ "$LOCAL_OS" == "msys" ] || [ "$LOCAL_OS" == "BusyBox" ] || [ "$LOCAL_OS" == "Cygwin" ] || [ "$LOCAL_OS" == "WinNT10" ]; then
|
||||||
|
localOsVar="$localOsVar $(uname -a)"
|
||||||
if [ "$PROGRAMW6432" != "" ]; then
|
if [ "$PROGRAMW6432" != "" ]; then
|
||||||
LOCAL_OS_BITNESS=64
|
LOCAL_OS_BITNESS=64
|
||||||
LOCAL_OS_FAMILY="Windows"
|
LOCAL_OS_FAMILY="Windows"
|
||||||
|
@ -604,6 +607,9 @@ function GetLocalOS {
|
||||||
# Get Host info for Unix
|
# Get Host info for Unix
|
||||||
else
|
else
|
||||||
LOCAL_OS_FAMILY="Unix"
|
LOCAL_OS_FAMILY="Unix"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$LOCAL_OS_FAMILY" == "Unix" ]; then
|
||||||
if uname -m | grep '64' > /dev/null 2>&1; then
|
if uname -m | grep '64' > /dev/null 2>&1; then
|
||||||
LOCAL_OS_BITNESS=64
|
LOCAL_OS_BITNESS=64
|
||||||
else
|
else
|
||||||
|
|
69
osync.sh
69
osync.sh
|
@ -7,12 +7,12 @@ PROGRAM="osync" # Rsync based two way sync engine with fault tolerance
|
||||||
AUTHOR="(C) 2013-2018 by Orsiris de Jong"
|
AUTHOR="(C) 2013-2018 by Orsiris de Jong"
|
||||||
CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr"
|
CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr"
|
||||||
PROGRAM_VERSION=1.3.0-beta1
|
PROGRAM_VERSION=1.3.0-beta1
|
||||||
PROGRAM_BUILD=2018101701
|
PROGRAM_BUILD=2018101801
|
||||||
IS_STABLE=no
|
IS_STABLE=no
|
||||||
|
|
||||||
|
|
||||||
_OFUNCTIONS_VERSION=2.3.0-RC2
|
_OFUNCTIONS_VERSION=2.3.0-RC2
|
||||||
_OFUNCTIONS_BUILD=2018101701
|
_OFUNCTIONS_BUILD=2018110502
|
||||||
_OFUNCTIONS_BOOTSTRAP=true
|
_OFUNCTIONS_BOOTSTRAP=true
|
||||||
|
|
||||||
if ! type "$BASH" > /dev/null; then
|
if ! type "$BASH" > /dev/null; then
|
||||||
|
@ -1022,7 +1022,7 @@ function ExecTasks {
|
||||||
# Check for valid exit codes
|
# Check for valid exit codes
|
||||||
if [ $(ArrayContains $retval "${validExitCodes[@]}") -eq 0 ]; then
|
if [ $(ArrayContains $retval "${validExitCodes[@]}") -eq 0 ]; then
|
||||||
if [ $noErrorLogsAtAll != true ]; then
|
if [ $noErrorLogsAtAll != true ]; then
|
||||||
Logger "${FUNCNAME[0]} called by [$id] finished monitoring pid [$pid] with exitcode [$retval]." "DEBUG"
|
Logger "${FUNCNAME[0]} called by [$id] finished monitoring pid [$pid] with exitcode [$retval]." "ERROR"
|
||||||
if [ "$functionMode" == "ParallelExec" ]; then
|
if [ "$functionMode" == "ParallelExec" ]; then
|
||||||
Logger "Command was [${commandsArrayPid[$pid]}]." "ERROR"
|
Logger "Command was [${commandsArrayPid[$pid]}]." "ERROR"
|
||||||
fi
|
fi
|
||||||
|
@ -1355,6 +1355,8 @@ function GetLocalOS {
|
||||||
# There is no good way to tell if currently running in BusyBox shell. Using sluggish way.
|
# There is no good way to tell if currently running in BusyBox shell. Using sluggish way.
|
||||||
if ls --help 2>&1 | grep -i "BusyBox" > /dev/null; then
|
if ls --help 2>&1 | grep -i "BusyBox" > /dev/null; then
|
||||||
localOsVar="BusyBox"
|
localOsVar="BusyBox"
|
||||||
|
elif set -o | grep "winxp" > /dev/null; then
|
||||||
|
localOsVar="BusyBox-w32"
|
||||||
else
|
else
|
||||||
# Detecting the special ubuntu userland in Windows 10 bash
|
# Detecting the special ubuntu userland in Windows 10 bash
|
||||||
if grep -i Microsoft /proc/sys/kernel/osrelease > /dev/null 2>&1; then
|
if grep -i Microsoft /proc/sys/kernel/osrelease > /dev/null 2>&1; then
|
||||||
|
@ -1387,7 +1389,7 @@ function GetLocalOS {
|
||||||
*"CYGWIN"*)
|
*"CYGWIN"*)
|
||||||
LOCAL_OS="Cygwin"
|
LOCAL_OS="Cygwin"
|
||||||
;;
|
;;
|
||||||
*"Microsoft"*)
|
*"Microsoft"*|*"MS/Windows"*)
|
||||||
LOCAL_OS="WinNT10"
|
LOCAL_OS="WinNT10"
|
||||||
;;
|
;;
|
||||||
*"Darwin"*)
|
*"Darwin"*)
|
||||||
|
@ -1418,7 +1420,8 @@ function GetLocalOS {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get Host info for Windows
|
# Get Host info for Windows
|
||||||
if [ "$LOCAL_OS" == "msys" ] || [ "$LOCAL_OS" == "BusyBox" ] || [ "$LOCAL_OS" == "Cygwin" ] || [ "$LOCAL_OS" == "WinNT10" ]; then localOsVar="$(uname -a)"
|
if [ "$LOCAL_OS" == "msys" ] || [ "$LOCAL_OS" == "BusyBox" ] || [ "$LOCAL_OS" == "Cygwin" ] || [ "$LOCAL_OS" == "WinNT10" ]; then
|
||||||
|
localOsVar="$localOsVar $(uname -a)"
|
||||||
if [ "$PROGRAMW6432" != "" ]; then
|
if [ "$PROGRAMW6432" != "" ]; then
|
||||||
LOCAL_OS_BITNESS=64
|
LOCAL_OS_BITNESS=64
|
||||||
LOCAL_OS_FAMILY="Windows"
|
LOCAL_OS_FAMILY="Windows"
|
||||||
|
@ -1432,6 +1435,9 @@ function GetLocalOS {
|
||||||
# Get Host info for Unix
|
# Get Host info for Unix
|
||||||
else
|
else
|
||||||
LOCAL_OS_FAMILY="Unix"
|
LOCAL_OS_FAMILY="Unix"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$LOCAL_OS_FAMILY" == "Unix" ]; then
|
||||||
if uname -m | grep '64' > /dev/null 2>&1; then
|
if uname -m | grep '64' > /dev/null 2>&1; then
|
||||||
LOCAL_OS_BITNESS=64
|
LOCAL_OS_BITNESS=64
|
||||||
else
|
else
|
||||||
|
@ -1975,14 +1981,14 @@ function InitLocalOSDependingSettings {
|
||||||
# Gets executed regardless of the need of remote connections. It is just that this code needs to get executed after we know if there is a remote os, and if yes, which one
|
# Gets executed regardless of the need of remote connections. It is just that this code needs to get executed after we know if there is a remote os, and if yes, which one
|
||||||
function InitRemoteOSDependingSettings {
|
function InitRemoteOSDependingSettings {
|
||||||
|
|
||||||
if [ "$REMOTE_OS" == "msys" ] || [ "$LOCAL_OS" == "Cygwin" ]; then
|
if [ "$REMOTE_OS" == "msys" ] || [ "$REMOTE_OS" == "Cygwin" ]; then
|
||||||
REMOTE_FIND_CMD=$(dirname $BASH)/find
|
REMOTE_FIND_CMD=$(dirname $BASH)/find
|
||||||
else
|
else
|
||||||
REMOTE_FIND_CMD=find
|
REMOTE_FIND_CMD=find
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## Stat command has different syntax on Linux and FreeBSD/MacOSX
|
## Stat command has different syntax on Linux and FreeBSD/MacOSX
|
||||||
if [ "$LOCAL_OS" == "MacOSX" ] || [ "$LOCAL_OS" == "BSD" ]; then
|
if [ "$REMOTE_OS" == "MacOSX" ] || [ "$REMOTE_OS" == "BSD" ]; then
|
||||||
REMOTE_STAT_CMD="stat -f \"%Sm\""
|
REMOTE_STAT_CMD="stat -f \"%Sm\""
|
||||||
REMOTE_STAT_CTIME_MTIME_CMD="stat -f \\\"%N;%c;%m\\\""
|
REMOTE_STAT_CTIME_MTIME_CMD="stat -f \\\"%N;%c;%m\\\""
|
||||||
else
|
else
|
||||||
|
@ -2161,13 +2167,26 @@ function SetConfFileValue () {
|
||||||
local value="${3}"
|
local value="${3}"
|
||||||
local separator="${4:-#}"
|
local separator="${4:-#}"
|
||||||
|
|
||||||
if grep "^$name=" "$file" > /dev/null; then
|
if [ -f "$file" ]; then
|
||||||
# Using -i.tmp for BSD compat
|
if grep "^$name=" "$file" > /dev/null 2>&1; then
|
||||||
sed -i.tmp "s$separator^$name=.*$separator$name=$value$separator" "$file"
|
# Using -i.tmp for BSD compat
|
||||||
rm -f "$file.tmp"
|
sed -i.tmp "s$separator^$name=.*$separator$name=$value$separator" "$file"
|
||||||
Logger "Set [$name] to [$value] in config file [$file]." "DEBUG"
|
if [ $? -ne 0 ]; then
|
||||||
|
Logger "Cannot update value [$name] to [$value] in config file [$file]." "ERROR"
|
||||||
|
fi
|
||||||
|
rm -f "$file.tmp"
|
||||||
|
Logger "Set [$name] to [$value] in config file [$file]." "DEBUG"
|
||||||
|
else
|
||||||
|
echo "$name=$value" >> "$file"
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
Logger "Cannot create value [$name] to [$value] in config file [$file]." "ERROR"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
Logger "Cannot set value [$name] to [$value] in config file [$file]." "ERROR"
|
echo "$name=$value" > "$file"
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
Logger "Config file [$file] does not exist. Failed to create it witn value [$name]." "ERROR"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3342,16 +3361,16 @@ function _getFileCtimeMtimeLocal {
|
||||||
echo -n "" > "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$replicaType.$SCRIPT_PID.$TSTAMP"
|
echo -n "" > "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$replicaType.$SCRIPT_PID.$TSTAMP"
|
||||||
|
|
||||||
while IFS='' read -r file; do
|
while IFS='' read -r file; do
|
||||||
$STAT_CTIME_MTIME_CMD "$replicaPath$file" >> "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$replicaType.$SCRIPT_PID.$TSTAMP"
|
$STAT_CTIME_MTIME_CMD "$replicaPath$file" >> "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$replicaType.$SCRIPT_PID.$TSTAMP" 2> "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$replicaType.error.$SCRIPT_PID.$TSTAMP"
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
Logger "Could not get file attributes for [$replicaPath$file]." "ERROR"
|
Logger "Could not get file attributes for [$replicaPath$file]." "ERROR"
|
||||||
echo "1" > "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.subshellError.$replicaType.$SCRIPT_PID.$TSTAMP"
|
echo "1" > "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.subshellError.$replicaType.$SCRIPT_PID.$TSTAMP"
|
||||||
fi
|
fi
|
||||||
done < "$fileList"
|
done < "$fileList"
|
||||||
if [ -f "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.subshellError.$replicaType.$SCRIPT_PID.$TSTAMP" ]; then
|
if [ -f "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.subshellError.$replicaType.$SCRIPT_PID.$TSTAMP" ]; then
|
||||||
Logger "Getting file attributes failed [$retval] on $replicaType. Stopping execution." "CRITICAL" $retval
|
Logger "Getting file time attributes failed [$retval] on $replicaType. Stopping execution." "CRITICAL" $retval
|
||||||
if [ -s "$RUN_DIR/$PROGRAM.ctime_mtime.$replicaType.$SCRIPT_PID.$TSTAMP" ]; then #WIP: does this file exist
|
if [ -s "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$replicaType.error.$SCRIPT_PID.$TSTAMP" ]; then
|
||||||
Logger "Command output:\n$(cat $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$replicaType.$SCRIPT_PID.$TSTAMP)" "WARN"
|
Logger "Command output:\n$(cat "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$replicaType.error.$SCRIPT_PID.$TSTAMP")" "WARN"
|
||||||
fi
|
fi
|
||||||
return 1
|
return 1
|
||||||
else
|
else
|
||||||
|
@ -5488,23 +5507,21 @@ function LogConflicts {
|
||||||
local subject
|
local subject
|
||||||
local body
|
local body
|
||||||
|
|
||||||
# We keep this in a separate if check because of the subshell used for Logger with _LOGGER_PREFIX
|
|
||||||
if [ -f "$RUN_DIR/$PROGRAM.conflictList.compare.$SCRIPT_PID.$TSTAMP" ]; then
|
if [ -f "$RUN_DIR/$PROGRAM.conflictList.compare.$SCRIPT_PID.$TSTAMP" ]; then
|
||||||
Logger "File conflicts: INITIATOR << >> TARGET" "ALWAYS"
|
Logger "File conflicts: INITIATOR << >> TARGET" "ALWAYS"
|
||||||
fi
|
> "${INITIATOR[$__replicaDir]}${INITIATOR[$__stateDir]}/${INITIATOR[$__conflictListFile]}"
|
||||||
|
|
||||||
|
|
||||||
_LOGGER_PREFIX=""
|
|
||||||
(
|
|
||||||
if [ -f "$RUN_DIR/$PROGRAM.conflictList.compare.$SCRIPT_PID.$TSTAMP" ]; then
|
|
||||||
echo "" > "${INITIATOR[$__replicaDir]}${INITIATOR[$__stateDir]}/${INITIATOR[$__conflictListFile]}"
|
|
||||||
while read -r line; do
|
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]}"
|
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"
|
done < "$RUN_DIR/$PROGRAM.conflictList.compare.$SCRIPT_PID.$TSTAMP"
|
||||||
|
|
||||||
|
(
|
||||||
|
_LOGGER_PREFIX=""
|
||||||
Logger "$(cat ${INITIATOR[$__replicaDir]}${INITIATOR[$__stateDir]}/${INITIATOR[$__conflictListFile]})" "ALWAYS"
|
Logger "$(cat ${INITIATOR[$__replicaDir]}${INITIATOR[$__stateDir]}/${INITIATOR[$__conflictListFile]})" "ALWAYS"
|
||||||
|
)
|
||||||
|
else
|
||||||
|
Logger "No conflictList file." "ERROR"
|
||||||
fi
|
fi
|
||||||
)
|
|
||||||
if [ "$ALERT_CONFLICTS" == "yes" ] && [ -s "$RUN_DIR/$PROGRAM.conflictList.compare.$SCRIPT_PID.$TSTAMP" ]; then
|
if [ "$ALERT_CONFLICTS" == "yes" ] && [ -s "$RUN_DIR/$PROGRAM.conflictList.compare.$SCRIPT_PID.$TSTAMP" ]; then
|
||||||
subject="Conflictual files found in [$INSTANCE_ID]"
|
subject="Conflictual files found in [$INSTANCE_ID]"
|
||||||
body="List of conflictual files:"$'\n'"$(cat ${INITIATOR[$__replicaDir]}${INITIATOR[$__stateDir]}/${INITIATOR[$__conflictListFile]})"
|
body="List of conflictual files:"$'\n'"$(cat ${INITIATOR[$__replicaDir]}${INITIATOR[$__stateDir]}/${INITIATOR[$__conflictListFile]})"
|
||||||
|
|
Loading…
Reference in New Issue