|
|
|
@ -4,10 +4,10 @@ PROGRAM="osync" # Rsync based two way sync engine with fault tolerance
|
|
|
|
|
AUTHOR="(C) 2013-2016 by Orsiris de Jong"
|
|
|
|
|
CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr"
|
|
|
|
|
PROGRAM_VERSION=1.1-dev
|
|
|
|
|
PROGRAM_BUILD=2016040303
|
|
|
|
|
PROGRAM_BUILD=2016040305
|
|
|
|
|
IS_STABLE=yes
|
|
|
|
|
|
|
|
|
|
## FUNC_BUILD=2016040102
|
|
|
|
|
## FUNC_BUILD=2016040301
|
|
|
|
|
## BEGIN Generic functions for osync & obackup written in 2013-2016 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr
|
|
|
|
|
|
|
|
|
|
## type -p does not work on platforms other than linux (bash). If if does not work, always assume output is not a zero exitcode
|
|
|
|
@ -1022,8 +1022,10 @@ function InitLocalOSSettings {
|
|
|
|
|
## Stat command has different syntax on Linux and FreeBSD/MacOSX
|
|
|
|
|
if [ "$LOCAL_OS" == "MacOSX" ] || [ "$LOCAL_OS" == "BSD" ]; then
|
|
|
|
|
STAT_CMD="stat -f \"%Sm\""
|
|
|
|
|
STAT_CTIME_MTIME_CMD="stat -f %N;%c;%m"
|
|
|
|
|
else
|
|
|
|
|
STAT_CMD="stat --format %y"
|
|
|
|
|
STAT_CTIME_MTIME_CMD="stat -c %n;%Z;%Y"
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1040,6 +1042,16 @@ function InitRemoteOSSettings {
|
|
|
|
|
else
|
|
|
|
|
REMOTE_FIND_CMD=find
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
## Stat command has different syntax on Linux and FreeBSD/MacOSX
|
|
|
|
|
if [ "$LOCAL_OS" == "MacOSX" ] || [ "$LOCAL_OS" == "BSD" ]; then
|
|
|
|
|
REMOTE_STAT_CMD="stat -f \"%Sm\""
|
|
|
|
|
REMOTE_STAT_CTIME_MTIME_CMD="stat -f \\\"%N;%c;%m\\\""
|
|
|
|
|
else
|
|
|
|
|
REMOTE_STAT_CMD="stat --format %y"
|
|
|
|
|
REMOTE_STAT_CTIME_MTIME_CMD="stat -c \\\"%n;%Z;%Y\\\""
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
## END Generic functions
|
|
|
|
@ -1606,7 +1618,7 @@ function _get_file_ctime_mtime_local {
|
|
|
|
|
|
|
|
|
|
#cat "$file_list" | xargs -I {} stat -c '%n;%Z;%Y' "$replica_path{}" | sort > "$RUN_DIR/$PROGRAM.ctime_mtime.$replica_type.$SCRIPT_PID"
|
|
|
|
|
echo -n "" > "$RUN_DIR/$PROGRAM.ctime_mtime.$replica_type.$SCRIPT_PID"
|
|
|
|
|
while read file; do stat -c '%n;%Z;%Y' "$replica_path$file" | sort > "$RUN_DIR/$PROGRAM.ctime_mtime.$replica_type.$SCRIPT_PID"; done < "$file_list"
|
|
|
|
|
while read file; do $STAT_CTIME_MTIME_CMD "$replica_path$file" | sort > "$RUN_DIR/$PROGRAM.ctime_mtime.$replica_type.$SCRIPT_PID"; done < "$file_list"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function _get_file_ctime_mtime_remote {
|
|
|
|
@ -1616,7 +1628,7 @@ function _get_file_ctime_mtime_remote {
|
|
|
|
|
__CheckArguments 3 $# ${FUNCNAME[0]} "$@" #__WITH_PARANOIA_DEBUG
|
|
|
|
|
|
|
|
|
|
local cmd=
|
|
|
|
|
cmd='cat "'$file_list'" | '$SSH_CMD' "while read file; do stat -c \"%n;%Z;%Y\" \"'$replica_path'\$file\"; done | sort" > "'$RUN_DIR/$PROGRAM.ctime_mtime.$replica_type.$SCRIPT_PID'"'
|
|
|
|
|
cmd='cat "'$file_list'" | '$SSH_CMD' "while read file; do '$REMOTE_STAT_CTIME_MTIME_CMD' \"'$replica_path'\$file\"; done | sort" > "'$RUN_DIR/$PROGRAM.ctime_mtime.$replica_type.$SCRIPT_PID'"'
|
|
|
|
|
Logger "CMD: $cmd" "DEBUG"
|
|
|
|
|
eval $cmd
|
|
|
|
|
WaitForCompletion $! $SOFT_MAX_EXEC_TIME $HARD_MAX_EXEC_TIME ${FUNCNAME[0]}
|
|
|
|
|