Updated config file structure, checks and upgrade script
This commit is contained in:
parent
f3bbaceb73
commit
f1cf7eb8e2
155
dev/n_osync.sh
155
dev/n_osync.sh
|
@ -4,12 +4,14 @@
|
||||||
#Check dryruns with nosuffix mode for timestampList
|
#Check dryruns with nosuffix mode for timestampList
|
||||||
|
|
||||||
PROGRAM="osync" # Rsync based two way sync engine with fault tolerance
|
PROGRAM="osync" # Rsync based two way sync engine with fault tolerance
|
||||||
AUTHOR="(C) 2013-2018 by Orsiris de Jong"
|
AUTHOR="(C) 2013-2019 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-pre-rc1
|
PROGRAM_VERSION=1.3.0-pre-rc1
|
||||||
PROGRAM_BUILD=2018122901
|
PROGRAM_BUILD=2019011001
|
||||||
IS_STABLE=no
|
IS_STABLE=no
|
||||||
|
|
||||||
|
CONFIG_FILE_REVISION_REQUIRED=1.3.0
|
||||||
|
|
||||||
##### Execution order #__WITH_PARANOIA_DEBUG
|
##### Execution order #__WITH_PARANOIA_DEBUG
|
||||||
##### Function Name Is parallel #__WITH_PARANOIA_DEBUG
|
##### Function Name Is parallel #__WITH_PARANOIA_DEBUG
|
||||||
# GetLocalOS no #__WITH_PARANOIA_DEBUG
|
# GetLocalOS no #__WITH_PARANOIA_DEBUG
|
||||||
|
@ -79,11 +81,11 @@ function TrapQuit {
|
||||||
|
|
||||||
if [ $ERROR_ALERT == true ]; then
|
if [ $ERROR_ALERT == true ]; then
|
||||||
UnlockReplicas
|
UnlockReplicas
|
||||||
if [ "$RUN_AFTER_CMD_ON_ERROR" == "yes" ]; then
|
if [ "$RUN_AFTER_CMD_ON_ERROR" == true ]; then
|
||||||
RunAfterHook
|
RunAfterHook
|
||||||
fi
|
fi
|
||||||
Logger "$PROGRAM finished with errors." "ERROR"
|
Logger "$PROGRAM finished with errors." "ERROR"
|
||||||
if [ "$_DEBUG" != "yes" ]
|
if [ "$_DEBUG" != true ]
|
||||||
then
|
then
|
||||||
SendAlert
|
SendAlert
|
||||||
else
|
else
|
||||||
|
@ -92,11 +94,11 @@ function TrapQuit {
|
||||||
exitcode=1
|
exitcode=1
|
||||||
elif [ $WARN_ALERT == true ]; then
|
elif [ $WARN_ALERT == true ]; then
|
||||||
UnlockReplicas
|
UnlockReplicas
|
||||||
if [ "$RUN_AFTER_CMD_ON_ERROR" == "yes" ]; then
|
if [ "$RUN_AFTER_CMD_ON_ERROR" == true ]; then
|
||||||
RunAfterHook
|
RunAfterHook
|
||||||
fi
|
fi
|
||||||
Logger "$PROGRAM finished with warnings." "WARN"
|
Logger "$PROGRAM finished with warnings." "WARN"
|
||||||
if [ "$_DEBUG" != "yes" ]
|
if [ "$_DEBUG" != true ]
|
||||||
then
|
then
|
||||||
SendAlert
|
SendAlert
|
||||||
else
|
else
|
||||||
|
@ -118,7 +120,7 @@ function TrapQuit {
|
||||||
function CheckEnvironment {
|
function CheckEnvironment {
|
||||||
__CheckArguments 0 $# "$@" #__WITH_PARANOIA_DEBUG
|
__CheckArguments 0 $# "$@" #__WITH_PARANOIA_DEBUG
|
||||||
|
|
||||||
if [ "$REMOTE_OPERATION" == "yes" ]; then
|
if [ "$REMOTE_OPERATION" == true ]; then
|
||||||
if ! type ssh > /dev/null 2>&1 ; then
|
if ! type ssh > /dev/null 2>&1 ; then
|
||||||
Logger "ssh not present. Cannot start sync." "CRITICAL"
|
Logger "ssh not present. Cannot start sync." "CRITICAL"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -150,7 +152,7 @@ function CheckEnvironment {
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$SUDO_EXEC" == "yes" ]; then
|
if [ "$SUDO_EXEC" == true ]; then
|
||||||
if ! type sudo > /dev/null 2>&1 ; then
|
if ! type sudo > /dev/null 2>&1 ; then
|
||||||
Logger "sudo not present. Sync cannot start." "CRITICAL"
|
Logger "sudo not present. Sync cannot start." "CRITICAL"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -162,22 +164,29 @@ function CheckEnvironment {
|
||||||
function CheckCurrentConfig {
|
function CheckCurrentConfig {
|
||||||
local fullCheck="${1:-true}"
|
local fullCheck="${1:-true}"
|
||||||
|
|
||||||
|
local test
|
||||||
|
local booleans
|
||||||
|
local num_vars
|
||||||
|
|
||||||
__CheckArguments 1 $# "$@" #__WITH_PARANOIA_DEBUG
|
__CheckArguments 1 $# "$@" #__WITH_PARANOIA_DEBUG
|
||||||
|
|
||||||
# Full check is for initiator driven runs
|
# Full check is for initiator driven runs
|
||||||
if [ $fullCheck == true ]; then
|
if [ $fullCheck == true ]; then
|
||||||
declare -a yes_no_vars=(CREATE_DIRS SUDO_EXEC SSH_COMPRESSION SSH_IGNORE_KNOWN_HOSTS REMOTE_HOST_PING PRESERVE_PERMISSIONS PRESERVE_OWNER PRESERVE_GROUP PRESERVE_EXECUTABILITY PRESERVE_ACL PRESERVE_XATTR COPY_SYMLINKS KEEP_DIRLINKS PRESERVE_HARDLINKS CHECKSUM RSYNC_COMPRESS CONFLICT_BACKUP CONFLICT_BACKUP_MULTIPLE SOFT_DELETE RESUME_SYNC FORCE_STRANGER_LOCK_RESUME PARTIAL DELTA_COPIES STOP_ON_CMD_ERROR RUN_AFTER_CMD_ON_ERROR)
|
declare -a booleans=(CREATE_DIRS SUDO_EXEC SSH_COMPRESSION SSH_IGNORE_KNOWN_HOSTS REMOTE_HOST_PING PRESERVE_PERMISSIONS PRESERVE_OWNER PRESERVE_GROUP PRESERVE_EXECUTABILITY PRESERVE_ACL PRESERVE_XATTR COPY_SYMLINKS KEEP_DIRLINKS PRESERVE_HARDLINKS CHECKSUM RSYNC_COMPRESS CONFLICT_BACKUP CONFLICT_BACKUP_MULTIPLE SOFT_DELETE RESUME_SYNC FORCE_STRANGER_LOCK_RESUME PARTIAL DELTA_COPIES STOP_ON_CMD_ERROR RUN_AFTER_CMD_ON_ERROR)
|
||||||
declare -a num_vars=(MINIMUM_SPACE BANDWIDTH SOFT_MAX_EXEC_TIME HARD_MAX_EXEC_TIME KEEP_LOGGING MIN_WAIT MAX_WAIT CONFLICT_BACKUP_DAYS SOFT_DELETE_DAYS RESUME_TRY MAX_EXEC_TIME_PER_CMD_BEFORE MAX_EXEC_TIME_PER_CMD_AFTER)
|
declare -a num_vars=(MINIMUM_SPACE BANDWIDTH SOFT_MAX_EXEC_TIME HARD_MAX_EXEC_TIME KEEP_LOGGING MIN_WAIT MAX_WAIT CONFLICT_BACKUP_DAYS SOFT_DELETE_DAYS RESUME_TRY MAX_EXEC_TIME_PER_CMD_BEFORE MAX_EXEC_TIME_PER_CMD_AFTER)
|
||||||
# target-helper runs need less configuration
|
# target-helper runs need less configuration
|
||||||
else
|
else
|
||||||
declare -a yes_no_vars=(SUDO_EXEC SSH_COMPRESSION SSH_IGNORE_KNOWN_HOSTS REMOTE_HOST_PING STOP_ON_CMD_ERROR RUN_AFTER_CMD_ON_ERROR)
|
declare -a booleans=(SUDO_EXEC SSH_COMPRESSION SSH_IGNORE_KNOWN_HOSTS REMOTE_HOST_PING STOP_ON_CMD_ERROR RUN_AFTER_CMD_ON_ERROR)
|
||||||
declare -a num_vars=(KEEP_LOGGING MIN_WAIT MAX_WAIT)
|
declare -a num_vars=(KEEP_LOGGING MIN_WAIT MAX_WAIT)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check all variables that should contain "yes" or "no"
|
# v2 config will use true / false instead of yes / no
|
||||||
for i in "${yes_no_vars[@]}"; do
|
# Check all variables that should contain "yes" or "no", true or false
|
||||||
test="if [ \"\$$i\" != \"yes\" ] && [ \"\$$i\" != \"no\" ]; then Logger \"Bogus $i value [\$$i] defined in config file. Correct your config file or update it using the update script if using and old version.\" \"CRITICAL\"; exit 1; fi"
|
for i in "${booleans[@]}"; do
|
||||||
|
#test="if [ \"\$$i\" != \"yes\" ] && [ \"\$$i\" != \"no\" ] && [ \"\$$i\" != true ] && [ \"\$$i\" != false ]; then Logger \"Bogus $i value [\$$i] defined in config file. Correct your config file or update it using the update script if using and old version.\" \"CRITICAL\"; exit 1; fi"
|
||||||
|
test="if [ \"\$$i\" != true ] && [ \"\$$i\" != false ]; then Logger \"Bogus $i value [\$$i] defined in config file. Correct your config file or update it using the update script if using and old version.\" \"CRITICAL\"; exit 1; fi"
|
||||||
eval "$test"
|
eval "$test"
|
||||||
|
# Fix for upcomming v2 where yes and no do not exist anymore
|
||||||
done
|
done
|
||||||
|
|
||||||
# Check all variables that should contain a numerical value >= 0
|
# Check all variables that should contain a numerical value >= 0
|
||||||
|
@ -187,6 +196,19 @@ function CheckCurrentConfig {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Change all booleans with "yes" or "no" to true / false for v2 config syntax compatibility
|
||||||
|
function UpdateBooleans {
|
||||||
|
local update
|
||||||
|
local booleans
|
||||||
|
|
||||||
|
declare -a booleans=(CREATE_DIRS SUDO_EXEC SSH_COMPRESSION SSH_IGNORE_KNOWN_HOSTS REMOTE_HOST_PING PRESERVE_PERMISSIONS PRESERVE_OWNER PRESERVE_GROUP PRESERVE_EXECUTABILITY PRESERVE_ACL PRESERVE_XATTR COPY_SYMLINKS KEEP_DIRLINKS PRESERVE_HARDLINKS CHECKSUM RSYNC_COMPRESS CONFLICT_BACKUP CONFLICT_BACKUP_MULTIPLE SOFT_DELETE RESUME_SYNC FORCE_STRANGER_LOCK_RESUME PARTIAL DELTA_COPIES STOP_ON_CMD_ERROR RUN_AFTER_CMD_ON_ERROR)
|
||||||
|
|
||||||
|
for i in "${booleans[@]}"; do
|
||||||
|
update="if [ \"\$$i\" == \"yes\" ]; then $i=true; fi; if [ \"\$$i\" == \"no\" ]; then $i=false; fi"
|
||||||
|
eval "$update"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
# Gets checked in quicksync and config file mode
|
# Gets checked in quicksync and config file mode
|
||||||
function CheckCurrentConfigAll {
|
function CheckCurrentConfigAll {
|
||||||
__CheckArguments 0 $# "$@" #__WITH_PARANOIA_DEBUG
|
__CheckArguments 0 $# "$@" #__WITH_PARANOIA_DEBUG
|
||||||
|
@ -208,7 +230,7 @@ function CheckCurrentConfigAll {
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$REMOTE_OPERATION" == "yes" ] && ([ ! -f "$SSH_RSA_PRIVATE_KEY" ] && [ ! -f "$SSH_PASSWORD_FILE" ]); then
|
if [ "$REMOTE_OPERATION" == true ] && ([ ! -f "$SSH_RSA_PRIVATE_KEY" ] && [ ! -f "$SSH_PASSWORD_FILE" ]); then
|
||||||
Logger "Cannot find rsa private key [$SSH_RSA_PRIVATE_KEY] nor password file [$SSH_PASSWORD_FILE]. No authentication method provided." "CRITICAL"
|
Logger "Cannot find rsa private key [$SSH_RSA_PRIVATE_KEY] nor password file [$SSH_PASSWORD_FILE]. No authentication method provided." "CRITICAL"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -235,7 +257,7 @@ function _CheckReplicasLocal {
|
||||||
local diskSpace
|
local diskSpace
|
||||||
|
|
||||||
if [ ! -d "$replicaPath" ]; then
|
if [ ! -d "$replicaPath" ]; then
|
||||||
if [ "$CREATE_DIRS" == "yes" ]; then
|
if [ "$CREATE_DIRS" == true ]; then
|
||||||
mkdir -p "$replicaPath" >> "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$replicaType.$SCRIPT_PID.$TSTAMP" 2>&1
|
mkdir -p "$replicaPath" >> "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$replicaType.$SCRIPT_PID.$TSTAMP" 2>&1
|
||||||
retval=$?
|
retval=$?
|
||||||
if [ $retval -ne 0 ]; then
|
if [ $retval -ne 0 ]; then
|
||||||
|
@ -300,7 +322,7 @@ include #### CleanUp SUBSET ####
|
||||||
|
|
||||||
function _CheckReplicasRemoteSub {
|
function _CheckReplicasRemoteSub {
|
||||||
if [ ! -d "$replicaPath" ]; then
|
if [ ! -d "$replicaPath" ]; then
|
||||||
if [ "$CREATE_DIRS" == "yes" ]; then
|
if [ "$CREATE_DIRS" == true ]; then
|
||||||
mkdir -p "$replicaPath"
|
mkdir -p "$replicaPath"
|
||||||
retval=$?
|
retval=$?
|
||||||
if [ $retval -ne 0 ]; then
|
if [ $retval -ne 0 ]; then
|
||||||
|
@ -366,7 +388,7 @@ function CheckReplicas {
|
||||||
local targetPid
|
local targetPid
|
||||||
local retval
|
local retval
|
||||||
|
|
||||||
if [ "$REMOTE_OPERATION" != "yes" ]; then
|
if [ "$REMOTE_OPERATION" != true ]; then
|
||||||
if [ "${INITIATOR[$__replicaDir]}" == "${TARGET[$__replicaDir]}" ]; then
|
if [ "${INITIATOR[$__replicaDir]}" == "${TARGET[$__replicaDir]}" ]; then
|
||||||
Logger "Initiator and target path [${INITIATOR[$__replicaDir]}] cannot be the same." "CRITICAL"
|
Logger "Initiator and target path [${INITIATOR[$__replicaDir]}] cannot be the same." "CRITICAL"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -375,7 +397,7 @@ function CheckReplicas {
|
||||||
|
|
||||||
_CheckReplicasLocal "${INITIATOR[$__replicaDir]}" "${INITIATOR[$__type]}" &
|
_CheckReplicasLocal "${INITIATOR[$__replicaDir]}" "${INITIATOR[$__type]}" &
|
||||||
initiatorPid=$!
|
initiatorPid=$!
|
||||||
if [ "$REMOTE_OPERATION" != "yes" ]; then
|
if [ "$REMOTE_OPERATION" != true ]; then
|
||||||
_CheckReplicasLocal "${TARGET[$__replicaDir]}" "${TARGET[$__type]}" &
|
_CheckReplicasLocal "${TARGET[$__replicaDir]}" "${TARGET[$__type]}" &
|
||||||
targetPid=$!
|
targetPid=$!
|
||||||
else
|
else
|
||||||
|
@ -528,7 +550,7 @@ function _HandleLocksRemoteSub {
|
||||||
RemoteLogger "There is a remote dead osync lock [$lockPid@$lockInstanceID] on target replica that corresponds to this initiator INSTANCE_ID. Pid [$lockPid] no longer running. Resuming." "NOTICE"
|
RemoteLogger "There is a remote dead osync lock [$lockPid@$lockInstanceID] on target replica that corresponds to this initiator INSTANCE_ID. Pid [$lockPid] no longer running. Resuming." "NOTICE"
|
||||||
writeLocks=true
|
writeLocks=true
|
||||||
else
|
else
|
||||||
if [ "$FORCE_STRANGER_LOCK_RESUME" == "yes" ]; then
|
if [ "$FORCE_STRANGER_LOCK_RESUME" == true ]; then
|
||||||
RemoteLogger "There is a remote (maybe dead) osync lock [$lockPid@$lockInstanceID] on target replica that does not correspond to this initiator INSTANCE_ID. Forcing resume." "WARN"
|
RemoteLogger "There is a remote (maybe dead) osync lock [$lockPid@$lockInstanceID] on target replica that does not correspond to this initiator INSTANCE_ID. Forcing resume." "WARN"
|
||||||
writeLocks=true
|
writeLocks=true
|
||||||
else
|
else
|
||||||
|
@ -602,7 +624,7 @@ function HandleLocks {
|
||||||
|
|
||||||
_HandleLocksLocal "${INITIATOR[$__replicaDir]}${INITIATOR[$__stateDir]}" "${INITIATOR[$__lockFile]}" "${INITIATOR[$__type]}" $overwrite &
|
_HandleLocksLocal "${INITIATOR[$__replicaDir]}${INITIATOR[$__stateDir]}" "${INITIATOR[$__lockFile]}" "${INITIATOR[$__type]}" $overwrite &
|
||||||
initiatorPid=$!
|
initiatorPid=$!
|
||||||
if [ "$REMOTE_OPERATION" != "yes" ]; then
|
if [ "$REMOTE_OPERATION" != true ]; then
|
||||||
_HandleLocksLocal "${TARGET[$__replicaDir]}${TARGET[$__stateDir]}" "${TARGET[$__lockFile]}" "${TARGET[$__type]}" $overwrite &
|
_HandleLocksLocal "${TARGET[$__replicaDir]}${TARGET[$__stateDir]}" "${TARGET[$__lockFile]}" "${TARGET[$__type]}" $overwrite &
|
||||||
targetPid=$!
|
targetPid=$!
|
||||||
else
|
else
|
||||||
|
@ -706,7 +728,7 @@ function UnlockReplicas {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $TARGET_LOCK_FILE_EXISTS == true ]; then
|
if [ $TARGET_LOCK_FILE_EXISTS == true ]; then
|
||||||
if [ "$REMOTE_OPERATION" != "yes" ]; then
|
if [ "$REMOTE_OPERATION" != true ]; then
|
||||||
_UnlockReplicasLocal "${TARGET[$__lockFile]}" "${TARGET[$__type]}" &
|
_UnlockReplicasLocal "${TARGET[$__lockFile]}" "${TARGET[$__type]}" &
|
||||||
targetPid=$!
|
targetPid=$!
|
||||||
else
|
else
|
||||||
|
@ -759,7 +781,7 @@ function treeList {
|
||||||
# (grep -v \"^\.$\" || :) = Removes line containing current directory sign '.'
|
# (grep -v \"^\.$\" || :) = Removes line containing current directory sign '.'
|
||||||
|
|
||||||
Logger "Creating $replicaType replica file list [$replicaPath]." "NOTICE"
|
Logger "Creating $replicaType replica file list [$replicaPath]." "NOTICE"
|
||||||
if [ "$REMOTE_OPERATION" == "yes" ] && [ "$replicaType" == "${TARGET[$__type]}" ]; then
|
if [ "$REMOTE_OPERATION" == true ] && [ "$replicaType" == "${TARGET[$__type]}" ]; then
|
||||||
CheckConnectivity3rdPartyHosts
|
CheckConnectivity3rdPartyHosts
|
||||||
CheckConnectivityRemoteHost
|
CheckConnectivityRemoteHost
|
||||||
rsyncCmd="$(type -p $RSYNC_EXECUTABLE) --rsync-path=\"env LC_ALL=C env _REMOTE_TOKEN=$_REMOTE_TOKEN $RSYNC_PATH\" $RSYNC_DEFAULT_ARGS $RSYNC_ATTR_ARGS $RSYNC_TYPE_ARGS --exclude \"$OSYNC_DIR\" $RSYNC_FULL_PATTERNS $RSYNC_PARTIAL_EXCLUDE -e \"$RSYNC_SSH_CMD\" --list-only $REMOTE_USER@$REMOTE_HOST:\"$escapedReplicaPath\" 2> \"$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$replicaType.error.$SCRIPT_PID.$TSTAMP\" | (grep -E \"^-|^d|^l\" || :) | (sed $SED_REGEX_ARG 's/^.{10} +[0-9,]+ [0-9/]{10} [0-9:]{8} //' || :) | (awk 'BEGIN { FS=\" -> \" } ; { print \$1 }' || :) | (grep -v \"^\.$\" || :) | sort > \"$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$replicaType.$SCRIPT_PID.$TSTAMP\""
|
rsyncCmd="$(type -p $RSYNC_EXECUTABLE) --rsync-path=\"env LC_ALL=C env _REMOTE_TOKEN=$_REMOTE_TOKEN $RSYNC_PATH\" $RSYNC_DEFAULT_ARGS $RSYNC_ATTR_ARGS $RSYNC_TYPE_ARGS --exclude \"$OSYNC_DIR\" $RSYNC_FULL_PATTERNS $RSYNC_PARTIAL_EXCLUDE -e \"$RSYNC_SSH_CMD\" --list-only $REMOTE_USER@$REMOTE_HOST:\"$escapedReplicaPath\" 2> \"$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$replicaType.error.$SCRIPT_PID.$TSTAMP\" | (grep -E \"^-|^d|^l\" || :) | (sed $SED_REGEX_ARG 's/^.{10} +[0-9,]+ [0-9/]{10} [0-9:]{8} //' || :) | (awk 'BEGIN { FS=\" -> \" } ; { print \$1 }' || :) | (grep -v \"^\.$\" || :) | sort > \"$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$replicaType.$SCRIPT_PID.$TSTAMP\""
|
||||||
|
@ -985,7 +1007,7 @@ function timestampList {
|
||||||
|
|
||||||
Logger "Getting file stats for $replicaType replica [$replicaPath]." "NOTICE"
|
Logger "Getting file stats for $replicaType replica [$replicaPath]." "NOTICE"
|
||||||
|
|
||||||
if [ "$REMOTE_OPERATION" == "yes" ] && [ "$replicaType" == "${TARGET[$__type]}" ]; then
|
if [ "$REMOTE_OPERATION" == true ] && [ "$replicaType" == "${TARGET[$__type]}" ]; then
|
||||||
CheckConnectivity3rdPartyHosts
|
CheckConnectivity3rdPartyHosts
|
||||||
CheckConnectivityRemoteHost
|
CheckConnectivityRemoteHost
|
||||||
_getFileCtimeMtimeRemote "$replicaPath" "$replicaType" "$fileList" "$timestampFilename"
|
_getFileCtimeMtimeRemote "$replicaPath" "$replicaType" "$fileList" "$timestampFilename"
|
||||||
|
@ -1091,7 +1113,7 @@ function syncAttrs {
|
||||||
|
|
||||||
Logger "Getting list of files that need updates." "NOTICE"
|
Logger "Getting list of files that need updates." "NOTICE"
|
||||||
|
|
||||||
if [ "$REMOTE_OPERATION" == "yes" ]; then
|
if [ "$REMOTE_OPERATION" == true ]; then
|
||||||
CheckConnectivity3rdPartyHosts
|
CheckConnectivity3rdPartyHosts
|
||||||
CheckConnectivityRemoteHost
|
CheckConnectivityRemoteHost
|
||||||
rsyncCmd="$(type -p $RSYNC_EXECUTABLE) --rsync-path=\"env LC_ALL=C env _REMOTE_TOKEN=$_REMOTE_TOKEN $RSYNC_PATH\" -i -n $RSYNC_DEFAULT_ARGS $RSYNC_ATTR_ARGS $RSYNC_PARTIAL_EXCLUDE -e \"$RSYNC_SSH_CMD\" --exclude \"$OSYNC_DIR\" $RSYNC_FULL_PATTERNS $RSYNC_PARTIAL_EXCLUDE \"$initiatorReplica\" $REMOTE_USER@$REMOTE_HOST:\"$targetReplica\" >> $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP 2>&1"
|
rsyncCmd="$(type -p $RSYNC_EXECUTABLE) --rsync-path=\"env LC_ALL=C env _REMOTE_TOKEN=$_REMOTE_TOKEN $RSYNC_PATH\" -i -n $RSYNC_DEFAULT_ARGS $RSYNC_ATTR_ARGS $RSYNC_PARTIAL_EXCLUDE -e \"$RSYNC_SSH_CMD\" --exclude \"$OSYNC_DIR\" $RSYNC_FULL_PATTERNS $RSYNC_PARTIAL_EXCLUDE \"$initiatorReplica\" $REMOTE_USER@$REMOTE_HOST:\"$targetReplica\" >> $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP 2>&1"
|
||||||
|
@ -1127,7 +1149,7 @@ function syncAttrs {
|
||||||
initiatorPid=$!
|
initiatorPid=$!
|
||||||
|
|
||||||
Logger "Getting ctimes for pending files on target." "NOTICE"
|
Logger "Getting ctimes for pending files on target." "NOTICE"
|
||||||
if [ "$REMOTE_OPERATION" != "yes" ]; then
|
if [ "$REMOTE_OPERATION" != true ]; then
|
||||||
_getFileCtimeMtimeLocal "${TARGET[$__replicaDir]}" "${TARGET[$__type]}" "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}-cleaned.$SCRIPT_PID.$TSTAMP" "$RUN_DIR/$PROGRAM.ctime_mtime___.${TARGET[$__type]}.$SCRIPT_PID.$TSTAMP" &
|
_getFileCtimeMtimeLocal "${TARGET[$__replicaDir]}" "${TARGET[$__type]}" "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}-cleaned.$SCRIPT_PID.$TSTAMP" "$RUN_DIR/$PROGRAM.ctime_mtime___.${TARGET[$__type]}.$SCRIPT_PID.$TSTAMP" &
|
||||||
targetPid=$!
|
targetPid=$!
|
||||||
else
|
else
|
||||||
|
@ -1170,7 +1192,7 @@ function syncAttrs {
|
||||||
|
|
||||||
Logger "Updating file attributes on $destReplica." "NOTICE"
|
Logger "Updating file attributes on $destReplica." "NOTICE"
|
||||||
|
|
||||||
if [ "$REMOTE_OPERATION" == "yes" ]; then
|
if [ "$REMOTE_OPERATION" == true ]; then
|
||||||
CheckConnectivity3rdPartyHosts
|
CheckConnectivity3rdPartyHosts
|
||||||
CheckConnectivityRemoteHost
|
CheckConnectivityRemoteHost
|
||||||
|
|
||||||
|
@ -1238,7 +1260,7 @@ function syncUpdate {
|
||||||
escDestDir=$(EscapeSpaces "${INITIATOR[$__replicaDir]}")
|
escDestDir=$(EscapeSpaces "${INITIATOR[$__replicaDir]}")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$REMOTE_OPERATION" == "yes" ]; then
|
if [ "$REMOTE_OPERATION" == true ]; then
|
||||||
CheckConnectivity3rdPartyHosts
|
CheckConnectivity3rdPartyHosts
|
||||||
CheckConnectivityRemoteHost
|
CheckConnectivityRemoteHost
|
||||||
if [ "$sourceReplica" == "${INITIATOR[$__type]}" ]; then
|
if [ "$sourceReplica" == "${INITIATOR[$__type]}" ]; then
|
||||||
|
@ -1302,7 +1324,7 @@ function _deleteLocal {
|
||||||
while read -r files; do
|
while read -r files; do
|
||||||
## On every run, check wheter the next item is already deleted because it is included in a directory already deleted
|
## On every run, check wheter the next item is already deleted because it is included in a directory already deleted
|
||||||
if [[ "$files" != "$previousFile/"* ]] && [ "$files" != "" ]; then
|
if [[ "$files" != "$previousFile/"* ]] && [ "$files" != "" ]; then
|
||||||
if [ "$SOFT_DELETE" != "no" ]; then
|
if [ "$SOFT_DELETE" != false ]; then
|
||||||
if [ $_DRYRUN == false ]; then
|
if [ $_DRYRUN == false ]; then
|
||||||
if [ -e "$replicaDir$deletionDir/$files" ] || [ -L "$replicaDir$deletionDir/$files" ]; then
|
if [ -e "$replicaDir$deletionDir/$files" ] || [ -L "$replicaDir$deletionDir/$files" ]; then
|
||||||
rm -rf "${replicaDir:?}$deletionDir/$files"
|
rm -rf "${replicaDir:?}$deletionDir/$files"
|
||||||
|
@ -1439,7 +1461,7 @@ function _deleteRemoteSub {
|
||||||
## On every run, check wheter the next item is already deleted because it is included in a directory already deleted
|
## On every run, check wheter the next item is already deleted because it is included in a directory already deleted
|
||||||
if [[ "$files" != "$previousFile/"* ]] && [ "$files" != "" ]; then
|
if [[ "$files" != "$previousFile/"* ]] && [ "$files" != "" ]; then
|
||||||
|
|
||||||
if [ "$SOFT_DELETE" != "no" ]; then
|
if [ "$SOFT_DELETE" != false ]; then
|
||||||
if [ $_DRYRUN == false ]; then
|
if [ $_DRYRUN == false ]; then
|
||||||
if [ -e "$REPLICA_DIR$DELETION_DIR/$files" ] || [ -L "$REPLICA_DIR$DELETION_DIR/$files" ]; then
|
if [ -e "$REPLICA_DIR$DELETION_DIR/$files" ] || [ -L "$REPLICA_DIR$DELETION_DIR/$files" ]; then
|
||||||
rm -rf "$REPLICA_DIR$DELETION_DIR/$files"
|
rm -rf "$REPLICA_DIR$DELETION_DIR/$files"
|
||||||
|
@ -1501,7 +1523,7 @@ function _deleteRemoteSub {
|
||||||
exit $retval
|
exit $retval
|
||||||
ENDSSH
|
ENDSSH
|
||||||
retval=$?
|
retval=$?
|
||||||
if [ -s "$RUN_DIR/$PROGRAM.remote_deletion.$SCRIPT_PID.$TSTAMP" ] && ([ $retval -ne 0 ] || [ "$_LOGGER_VERBOSE" == "yes" ]); then
|
if [ -s "$RUN_DIR/$PROGRAM.remote_deletion.$SCRIPT_PID.$TSTAMP" ] && ([ $retval -ne 0 ] || [ "$_LOGGER_VERBOSE" == true ]); then
|
||||||
(
|
(
|
||||||
_LOGGER_PREFIX="RR"
|
_LOGGER_PREFIX="RR"
|
||||||
Logger "$(cat $RUN_DIR/$PROGRAM.remote_deletion.$SCRIPT_PID.$TSTAMP)" "ERROR"
|
Logger "$(cat $RUN_DIR/$PROGRAM.remote_deletion.$SCRIPT_PID.$TSTAMP)" "ERROR"
|
||||||
|
@ -1553,7 +1575,7 @@ function deletionPropagation {
|
||||||
replicaDir="${TARGET[$__replicaDir]}"
|
replicaDir="${TARGET[$__replicaDir]}"
|
||||||
deleteDir="${TARGET[$__deleteDir]}"
|
deleteDir="${TARGET[$__deleteDir]}"
|
||||||
|
|
||||||
if [ "$REMOTE_OPERATION" == "yes" ]; then
|
if [ "$REMOTE_OPERATION" == true ]; then
|
||||||
_deleteRemote "${TARGET[$__type]}" "$replicaDir" "$deleteDir"
|
_deleteRemote "${TARGET[$__type]}" "$replicaDir" "$deleteDir"
|
||||||
else
|
else
|
||||||
_deleteLocal "${TARGET[$__type]}" "$replicaDir" "$deleteDir"
|
_deleteLocal "${TARGET[$__type]}" "$replicaDir" "$deleteDir"
|
||||||
|
@ -1651,7 +1673,7 @@ function Sync {
|
||||||
|
|
||||||
Logger "Starting synchronization task." "NOTICE"
|
Logger "Starting synchronization task." "NOTICE"
|
||||||
|
|
||||||
if [ "$RESUME_SYNC" != "no" ]; then
|
if [ "$RESUME_SYNC" != false ]; then
|
||||||
if [ -f "${INITIATOR[$__resumeCount]}" ]; then
|
if [ -f "${INITIATOR[$__resumeCount]}" ]; then
|
||||||
resumeCount=$(cat "${INITIATOR[$__resumeCount]}")
|
resumeCount=$(cat "${INITIATOR[$__resumeCount]}")
|
||||||
else
|
else
|
||||||
|
@ -1792,9 +1814,9 @@ function Sync {
|
||||||
|
|
||||||
## Step 2a & 2b
|
## Step 2a & 2b
|
||||||
if [ "$resumeInitiator" == "${SYNC_ACTION[2]}" ] || [ "$resumeTarget" == "${SYNC_ACTION[2]}" ]; then
|
if [ "$resumeInitiator" == "${SYNC_ACTION[2]}" ] || [ "$resumeTarget" == "${SYNC_ACTION[2]}" ]; then
|
||||||
#if [[ "$RSYNC_ATTR_ARGS" == *"-X"* ]] || [[ "$RSYNC_ATTR_ARGS" == *"-A"* ]] || [ "$LOG_CONFLICTS" == "yes" ]; then
|
#if [[ "$RSYNC_ATTR_ARGS" == *"-X"* ]] || [[ "$RSYNC_ATTR_ARGS" == *"-A"* ]] || [ "$LOG_CONFLICTS" == true ]; then
|
||||||
#TODO: refactor in v1.3 with syncattrs
|
#TODO: refactor in v1.3 with syncattrs
|
||||||
if [ "$LOG_CONFLICTS" == "yes" ]; then
|
if [ "$LOG_CONFLICTS" == true ]; then
|
||||||
|
|
||||||
if [ "$resumeInitiator" == "${SYNC_ACTION[2]}" ]; then
|
if [ "$resumeInitiator" == "${SYNC_ACTION[2]}" ]; then
|
||||||
timestampList "${INITIATOR[$__replicaDir]}" "${INITIATOR[$__type]}" "${INITIATOR[$__replicaDir]}${INITIATOR[$__stateDir]}/${INITIATOR[$__type]}${INITIATOR[$__treeCurrentFile]}" "${INITIATOR[$__replicaDir]}${INITIATOR[$__stateDir]}/${INITIATOR[$__type]}${INITIATOR[$__timestampCurrentFile]}" &
|
timestampList "${INITIATOR[$__replicaDir]}" "${INITIATOR[$__type]}" "${INITIATOR[$__replicaDir]}${INITIATOR[$__stateDir]}/${INITIATOR[$__type]}${INITIATOR[$__treeCurrentFile]}" "${INITIATOR[$__replicaDir]}${INITIATOR[$__stateDir]}/${INITIATOR[$__type]}${INITIATOR[$__timestampCurrentFile]}" &
|
||||||
|
@ -1847,7 +1869,7 @@ function Sync {
|
||||||
|
|
||||||
## Step 3a & 3b
|
## Step 3a & 3b
|
||||||
if [ "$resumeInitiator" == "${SYNC_ACTION[3]}" ] || [ "$resumeTarget" == "${SYNC_ACTION[3]}" ]; then
|
if [ "$resumeInitiator" == "${SYNC_ACTION[3]}" ] || [ "$resumeTarget" == "${SYNC_ACTION[3]}" ]; then
|
||||||
if [ "$LOG_CONFLICTS" == "yes" ]; then
|
if [ "$LOG_CONFLICTS" == true ]; then
|
||||||
conflictList "${INITIATOR[$__timestampCurrentFile]}" "${INITIATOR[$__timestampAfterFileNoSuffix]}" &
|
conflictList "${INITIATOR[$__timestampCurrentFile]}" "${INITIATOR[$__timestampAfterFileNoSuffix]}" &
|
||||||
ExecTasks $! "${FUNCNAME[0]}_conflictList" false 0 0 $SOFT_MAX_EXEC_TIME $HARD_MAX_EXEC_TIME false $SLEEP_TIME $KEEP_LOGGING
|
ExecTasks $! "${FUNCNAME[0]}_conflictList" false 0 0 $SOFT_MAX_EXEC_TIME $HARD_MAX_EXEC_TIME false $SLEEP_TIME $KEEP_LOGGING
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
|
@ -2040,9 +2062,9 @@ function Sync {
|
||||||
|
|
||||||
# Step 8a & 8b
|
# Step 8a & 8b
|
||||||
if [ "$resumeInitiator" == "${SYNC_ACTION[8]}" ] || [ "$resumeTarget" == "${SYNC_ACTION[8]}" ]; then
|
if [ "$resumeInitiator" == "${SYNC_ACTION[8]}" ] || [ "$resumeTarget" == "${SYNC_ACTION[8]}" ]; then
|
||||||
#if [[ "$RSYNC_ATTR_ARGS" == *"-X"* ]] || [[ "$RSYNC_ATTR_ARGS" == *"-A"* ]] || [ "$LOG_CONFLICTS" == "yes" ]; then
|
#if [[ "$RSYNC_ATTR_ARGS" == *"-X"* ]] || [[ "$RSYNC_ATTR_ARGS" == *"-A"* ]] || [ "$LOG_CONFLICTS" == true ]; then
|
||||||
#TODO: refactor in v1.3 with syncattrs
|
#TODO: refactor in v1.3 with syncattrs
|
||||||
if [ "$LOG_CONFLICTS" == "yes" ]; then
|
if [ "$LOG_CONFLICTS" == true ]; then
|
||||||
|
|
||||||
if [ "$resumeInitiator" == "${SYNC_ACTION[8]}" ]; then
|
if [ "$resumeInitiator" == "${SYNC_ACTION[8]}" ]; then
|
||||||
timestampList "${INITIATOR[$__replicaDir]}" "${INITIATOR[$__type]}" "${INITIATOR[$__replicaDir]}${INITIATOR[$__stateDir]}/${INITIATOR[$__type]}${INITIATOR[$__treeAfterFile]}" "${INITIATOR[$__replicaDir]}${INITIATOR[$__stateDir]}/${INITIATOR[$__type]}${INITIATOR[$__timestampAfterFile]}" &
|
timestampList "${INITIATOR[$__replicaDir]}" "${INITIATOR[$__type]}" "${INITIATOR[$__replicaDir]}${INITIATOR[$__stateDir]}/${INITIATOR[$__type]}${INITIATOR[$__treeAfterFile]}" "${INITIATOR[$__replicaDir]}${INITIATOR[$__stateDir]}/${INITIATOR[$__type]}${INITIATOR[$__timestampAfterFile]}" &
|
||||||
|
@ -2249,12 +2271,12 @@ function SoftDelete {
|
||||||
local initiatorPid
|
local initiatorPid
|
||||||
local targetPid
|
local targetPid
|
||||||
|
|
||||||
if [ "$CONFLICT_BACKUP" != "no" ] && [ $CONFLICT_BACKUP_DAYS -ne 0 ]; then
|
if [ "$CONFLICT_BACKUP" != false ] && [ $CONFLICT_BACKUP_DAYS -ne 0 ]; then
|
||||||
Logger "Running conflict backup cleanup." "NOTICE"
|
Logger "Running conflict backup cleanup." "NOTICE"
|
||||||
|
|
||||||
_SoftDeleteLocal "${INITIATOR[$__type]}" "${INITIATOR[$__replicaDir]}${INITIATOR[$__backupDir]}" $CONFLICT_BACKUP_DAYS "conflict backup" &
|
_SoftDeleteLocal "${INITIATOR[$__type]}" "${INITIATOR[$__replicaDir]}${INITIATOR[$__backupDir]}" $CONFLICT_BACKUP_DAYS "conflict backup" &
|
||||||
initiatorPid=$!
|
initiatorPid=$!
|
||||||
if [ "$REMOTE_OPERATION" != "yes" ]; then
|
if [ "$REMOTE_OPERATION" != true ]; then
|
||||||
_SoftDeleteLocal "${TARGET[$__type]}" "${TARGET[$__replicaDir]}${TARGET[$__backupDir]}" $CONFLICT_BACKUP_DAYS "conflict backup" &
|
_SoftDeleteLocal "${TARGET[$__type]}" "${TARGET[$__replicaDir]}${TARGET[$__backupDir]}" $CONFLICT_BACKUP_DAYS "conflict backup" &
|
||||||
targetPid=$!
|
targetPid=$!
|
||||||
else
|
else
|
||||||
|
@ -2267,12 +2289,12 @@ function SoftDelete {
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$SOFT_DELETE" != "no" ] && [ $SOFT_DELETE_DAYS -ne 0 ]; then
|
if [ "$SOFT_DELETE" != false ] && [ $SOFT_DELETE_DAYS -ne 0 ]; then
|
||||||
Logger "Running soft deletion cleanup." "NOTICE"
|
Logger "Running soft deletion cleanup." "NOTICE"
|
||||||
|
|
||||||
_SoftDeleteLocal "${INITIATOR[$__type]}" "${INITIATOR[$__replicaDir]}${INITIATOR[$__deleteDir]}" $SOFT_DELETE_DAYS "softdelete" &
|
_SoftDeleteLocal "${INITIATOR[$__type]}" "${INITIATOR[$__replicaDir]}${INITIATOR[$__deleteDir]}" $SOFT_DELETE_DAYS "softdelete" &
|
||||||
initiatorPid=$!
|
initiatorPid=$!
|
||||||
if [ "$REMOTE_OPERATION" != "yes" ]; then
|
if [ "$REMOTE_OPERATION" != true ]; then
|
||||||
_SoftDeleteLocal "${TARGET[$__type]}" "${TARGET[$__replicaDir]}${TARGET[$__deleteDir]}" $SOFT_DELETE_DAYS "softdelete" &
|
_SoftDeleteLocal "${TARGET[$__type]}" "${TARGET[$__replicaDir]}${TARGET[$__deleteDir]}" $SOFT_DELETE_DAYS "softdelete" &
|
||||||
targetPid=$!
|
targetPid=$!
|
||||||
else
|
else
|
||||||
|
@ -2350,7 +2372,7 @@ ENDSSH
|
||||||
function TriggerInitiatorRun {
|
function TriggerInitiatorRun {
|
||||||
__CheckArguments 0 $# "$@" #__WITH_PARANOIA_DEBUG
|
__CheckArguments 0 $# "$@" #__WITH_PARANOIA_DEBUG
|
||||||
|
|
||||||
if [ "$REMOTE_OPERATION" != "no" ]; then
|
if [ "$REMOTE_OPERATION" != false ]; then
|
||||||
_TriggerInitiatorRunRemote
|
_TriggerInitiatorRunRemote
|
||||||
else
|
else
|
||||||
_TriggerInitiatorRunLocal
|
_TriggerInitiatorRunLocal
|
||||||
|
@ -2405,7 +2427,7 @@ function Summary {
|
||||||
_SummaryFromRsyncFile "${INITIATOR[$__replicaDir]}" "$RUN_DIR/$PROGRAM.update.initiator.$SCRIPT_PID.$TSTAMP" "+ <<"
|
_SummaryFromRsyncFile "${INITIATOR[$__replicaDir]}" "$RUN_DIR/$PROGRAM.update.initiator.$SCRIPT_PID.$TSTAMP" "+ <<"
|
||||||
|
|
||||||
Logger "File deletions: INITIATOR << >> TARGET" "ALWAYS"
|
Logger "File deletions: INITIATOR << >> TARGET" "ALWAYS"
|
||||||
if [ "$REMOTE_OPERATION" == "yes" ]; then
|
if [ "$REMOTE_OPERATION" == true ]; then
|
||||||
_SummaryFromDeleteFile "${TARGET[$__replicaDir]}" "${INITIATOR[$__replicaDir]}${INITIATOR[$__stateDir]}/target${TARGET[$__successDeletedListFile]}" "- >>"
|
_SummaryFromDeleteFile "${TARGET[$__replicaDir]}" "${INITIATOR[$__replicaDir]}${INITIATOR[$__stateDir]}/target${TARGET[$__successDeletedListFile]}" "- >>"
|
||||||
else
|
else
|
||||||
_SummaryFromDeleteFile "${TARGET[$__replicaDir]}" "$RUN_DIR/$PROGRAM.delete.target.$SCRIPT_PID.$TSTAMP" "- >>"
|
_SummaryFromDeleteFile "${TARGET[$__replicaDir]}" "$RUN_DIR/$PROGRAM.delete.target.$SCRIPT_PID.$TSTAMP" "- >>"
|
||||||
|
@ -2435,7 +2457,7 @@ function LogConflicts {
|
||||||
Logger "No conflictList file." "NOTICE"
|
Logger "No conflictList file." "NOTICE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$ALERT_CONFLICTS" == "yes" ] && [ -s "$RUN_DIR/$PROGRAM.conflictList.compare.$SCRIPT_PID.$TSTAMP" ]; then
|
if [ "$ALERT_CONFLICTS" == true ] && [ -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]})"
|
||||||
|
|
||||||
|
@ -2451,7 +2473,7 @@ function Init {
|
||||||
set -o errtrace
|
set -o errtrace
|
||||||
|
|
||||||
# Do not use exit and quit traps if osync runs in monitor mode
|
# Do not use exit and quit traps if osync runs in monitor mode
|
||||||
if [ $_SYNC_ON_CHANGES == "no" ]; then
|
if [ $_SYNC_ON_CHANGES == false ]; then
|
||||||
trap TrapStop INT HUP TERM QUIT
|
trap TrapStop INT HUP TERM QUIT
|
||||||
trap TrapQuit EXIT
|
trap TrapQuit EXIT
|
||||||
else
|
else
|
||||||
|
@ -2465,7 +2487,7 @@ function Init {
|
||||||
|
|
||||||
## Test if target dir is a ssh uri, and if yes, break it down it its values
|
## Test if target dir is a ssh uri, and if yes, break it down it its values
|
||||||
if [ "${TARGET_SYNC_DIR:0:6}" == "ssh://" ]; then
|
if [ "${TARGET_SYNC_DIR:0:6}" == "ssh://" ]; then
|
||||||
REMOTE_OPERATION="yes"
|
REMOTE_OPERATION=true
|
||||||
|
|
||||||
# remove leadng 'ssh://'
|
# remove leadng 'ssh://'
|
||||||
uri=${TARGET_SYNC_DIR#ssh://*}
|
uri=${TARGET_SYNC_DIR#ssh://*}
|
||||||
|
@ -2497,7 +2519,7 @@ function Init {
|
||||||
# remove everything before first '/'
|
# remove everything before first '/'
|
||||||
TARGET_SYNC_DIR=${hosturiandpath#*/}
|
TARGET_SYNC_DIR=${hosturiandpath#*/}
|
||||||
elif [ "${INITIATOR_SYNC_DIR:0:6}" == "ssh://" ]; then
|
elif [ "${INITIATOR_SYNC_DIR:0:6}" == "ssh://" ]; then
|
||||||
REMOTE_OPERATION="yes"
|
REMOTE_OPERATION=true
|
||||||
|
|
||||||
# remove leadng 'ssh://'
|
# remove leadng 'ssh://'
|
||||||
uri=${INITIATOR_SYNC_DIR#ssh://*}
|
uri=${INITIATOR_SYNC_DIR#ssh://*}
|
||||||
|
@ -2529,7 +2551,7 @@ function Init {
|
||||||
# remove everything before first '/'
|
# remove everything before first '/'
|
||||||
INITIATOR_SYNC_DIR=${hosturiandpath#*/}
|
INITIATOR_SYNC_DIR=${hosturiandpath#*/}
|
||||||
else
|
else
|
||||||
REMOTE_OPERATION="no"
|
REMOTE_OPERATION=false
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$INITIATOR_SYNC_DIR" == "" ] || [ "$TARGET_SYNC_DIR" == "" ]; then
|
if [ "$INITIATOR_SYNC_DIR" == "" ] || [ "$TARGET_SYNC_DIR" == "" ]; then
|
||||||
|
@ -2653,10 +2675,10 @@ function Init {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## Conflict options
|
## Conflict options
|
||||||
if [ "$CONFLICT_BACKUP" != "no" ]; then
|
if [ "$CONFLICT_BACKUP" != false ]; then
|
||||||
INITIATOR_BACKUP="--backup --backup-dir=\"${INITIATOR[$__backupDir]}\""
|
INITIATOR_BACKUP="--backup --backup-dir=\"${INITIATOR[$__backupDir]}\""
|
||||||
TARGET_BACKUP="--backup --backup-dir=\"${TARGET[$__backupDir]}\""
|
TARGET_BACKUP="--backup --backup-dir=\"${TARGET[$__backupDir]}\""
|
||||||
if [ "$CONFLICT_BACKUP_MULTIPLE" == "yes" ]; then
|
if [ "$CONFLICT_BACKUP_MULTIPLE" == true ]; then
|
||||||
INITIATOR_BACKUP="$INITIATOR_BACKUP --suffix .$(date +%Y.%m.%d-%H.%M.%S)"
|
INITIATOR_BACKUP="$INITIATOR_BACKUP --suffix .$(date +%Y.%m.%d-%H.%M.%S)"
|
||||||
TARGET_BACKUP="$TARGET_BACKUP --suffix .$(date +%Y.%m.%d-%H.%M.%S)"
|
TARGET_BACKUP="$TARGET_BACKUP --suffix .$(date +%Y.%m.%d-%H.%M.%S)"
|
||||||
fi
|
fi
|
||||||
|
@ -2689,7 +2711,7 @@ function Main {
|
||||||
function Usage {
|
function Usage {
|
||||||
__CheckArguments 0 $# "$@" #__WITH_PARANOIA_DEBUG
|
__CheckArguments 0 $# "$@" #__WITH_PARANOIA_DEBUG
|
||||||
|
|
||||||
if [ "$IS_STABLE" != "yes" ]; then
|
if [ "$IS_STABLE" != true ]; then
|
||||||
echo -e "\e[93mThis is an unstable dev build. Please use with caution.\e[0m"
|
echo -e "\e[93mThis is an unstable dev build. Please use with caution.\e[0m"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -2853,8 +2875,8 @@ DESTINATION_MAILS=""
|
||||||
INITIATOR_LOCK_FILE_EXISTS=false
|
INITIATOR_LOCK_FILE_EXISTS=false
|
||||||
TARGET_LOCK_FILE_EXISTS=false
|
TARGET_LOCK_FILE_EXISTS=false
|
||||||
FORCE_UNLOCK=false
|
FORCE_UNLOCK=false
|
||||||
LOG_CONFLICTS="no"
|
LOG_CONFLICTS=false
|
||||||
ALERT_CONFLICTS="no"
|
ALERT_CONFLICTS=false
|
||||||
no_maxtime=false
|
no_maxtime=false
|
||||||
opts=""
|
opts=""
|
||||||
ERROR_ALERT=false
|
ERROR_ALERT=false
|
||||||
|
@ -2863,11 +2885,11 @@ WARN_ALERT=false
|
||||||
SOFT_STOP=2
|
SOFT_STOP=2
|
||||||
# Number of given replicas in command line
|
# Number of given replicas in command line
|
||||||
_QUICK_SYNC=0
|
_QUICK_SYNC=0
|
||||||
_SYNC_ON_CHANGES="no"
|
_SYNC_ON_CHANGES=false
|
||||||
_NOLOCKS=false
|
_NOLOCKS=false
|
||||||
osync_cmd=$0
|
osync_cmd=$0
|
||||||
_SUMMARY=false
|
_SUMMARY=false
|
||||||
INITIALIZE="no"
|
INITIALIZE=false
|
||||||
if [ "$MIN_WAIT" == "" ]; then
|
if [ "$MIN_WAIT" == "" ]; then
|
||||||
MIN_WAIT=60
|
MIN_WAIT=60
|
||||||
fi
|
fi
|
||||||
|
@ -2902,7 +2924,7 @@ function GetCommandlineArguments {
|
||||||
opts=$opts" --stats"
|
opts=$opts" --stats"
|
||||||
;;
|
;;
|
||||||
--partial)
|
--partial)
|
||||||
PARTIAL="yes"
|
PARTIAL=true
|
||||||
opts=$opts" --partial"
|
opts=$opts" --partial"
|
||||||
;;
|
;;
|
||||||
--force-unlock)
|
--force-unlock)
|
||||||
|
@ -2968,16 +2990,16 @@ function GetCommandlineArguments {
|
||||||
_SUMMARY=true
|
_SUMMARY=true
|
||||||
;;
|
;;
|
||||||
--log-conflicts)
|
--log-conflicts)
|
||||||
LOG_CONFLICTS="yes"
|
LOG_CONFLICTS=true
|
||||||
opts=$opts" --log-conflicts"
|
opts=$opts" --log-conflicts"
|
||||||
;;
|
;;
|
||||||
--alert-conflicts)
|
--alert-conflicts)
|
||||||
ALERT_CONFLICTS="yes"
|
ALERT_CONFLICTS=true
|
||||||
LOG_CONFLICTS="yes"
|
LOG_CONFLICTS=true
|
||||||
opts=$opts" --alert-conflicts"
|
opts=$opts" --alert-conflicts"
|
||||||
;;
|
;;
|
||||||
--initialize)
|
--initialize)
|
||||||
INITIALIZE="yes"
|
INITIALIZE=true
|
||||||
opts=$opts" --initialize"
|
opts=$opts" --initialize"
|
||||||
;;
|
;;
|
||||||
--no-prefix)
|
--no-prefix)
|
||||||
|
@ -3055,7 +3077,7 @@ if [ $_QUICK_SYNC -eq 2 ]; then
|
||||||
# First character shouldn't be '-' when config file given
|
# First character shouldn't be '-' when config file given
|
||||||
elif [ "${1:0:1}" != "-" ]; then
|
elif [ "${1:0:1}" != "-" ]; then
|
||||||
ConfigFile="${1}"
|
ConfigFile="${1}"
|
||||||
LoadConfigFile "$ConfigFile"
|
LoadConfigFile "$ConfigFile" $CONFIG_FILE_REVISION_REQUIRED
|
||||||
else
|
else
|
||||||
Logger "Wrong arguments given. Expecting a config file or initiator and target arguments." "CRITICAL"
|
Logger "Wrong arguments given. Expecting a config file or initiator and target arguments." "CRITICAL"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -3078,7 +3100,7 @@ else
|
||||||
Logger "Script begin, logging to [$LOG_FILE]." "DEBUG"
|
Logger "Script begin, logging to [$LOG_FILE]." "DEBUG"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$IS_STABLE" != "yes" ]; then
|
if [ "$IS_STABLE" != true ]; then
|
||||||
Logger "This is an unstable dev build [$PROGRAM_BUILD]. Please use with caution." "WARN"
|
Logger "This is an unstable dev build [$PROGRAM_BUILD]. Please use with caution." "WARN"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -3092,13 +3114,16 @@ PostInit
|
||||||
# Add exclusion of $INITIATOR[$__updateTriggerFile] to rsync patterns used by sync functions, but not by daemon
|
# Add exclusion of $INITIATOR[$__updateTriggerFile] to rsync patterns used by sync functions, but not by daemon
|
||||||
RSYNC_FULL_PATTERNS="$RSYNC_PATTERNS --exclude=${INITIATOR[$__updateTriggerFile]}"
|
RSYNC_FULL_PATTERNS="$RSYNC_PATTERNS --exclude=${INITIATOR[$__updateTriggerFile]}"
|
||||||
|
|
||||||
|
# v2 config syntax compatibility
|
||||||
|
UpdateBooleans
|
||||||
if [ $_QUICK_SYNC -lt 2 ]; then
|
if [ $_QUICK_SYNC -lt 2 ]; then
|
||||||
if [ "$_SYNC_ON_CHANGES" == "no" ]; then
|
if [ "$_SYNC_ON_CHANGES" == false ]; then
|
||||||
CheckCurrentConfig true
|
CheckCurrentConfig true
|
||||||
else
|
else
|
||||||
CheckCurrentConfig false
|
CheckCurrentConfig false
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CheckCurrentConfigAll
|
CheckCurrentConfigAll
|
||||||
DATE=$(date)
|
DATE=$(date)
|
||||||
Logger "-------------------------------------------------------------" "NOTICE"
|
Logger "-------------------------------------------------------------" "NOTICE"
|
||||||
|
@ -3119,7 +3144,7 @@ else
|
||||||
CheckReplicas
|
CheckReplicas
|
||||||
RunBeforeHook
|
RunBeforeHook
|
||||||
|
|
||||||
if [ "$INITIALIZE" == "yes" ]; then
|
if [ "$INITIALIZE" == true ]; then
|
||||||
HandleLocks
|
HandleLocks
|
||||||
Initialize
|
Initialize
|
||||||
else
|
else
|
||||||
|
@ -3130,7 +3155,7 @@ else
|
||||||
if [ $_SUMMARY == true ]; then
|
if [ $_SUMMARY == true ]; then
|
||||||
Summary
|
Summary
|
||||||
fi
|
fi
|
||||||
if [ $LOG_CONFLICTS == "yes" ]; then
|
if [ $LOG_CONFLICTS == true ]; then
|
||||||
LogConflicts
|
LogConflicts
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
## Generic and highly portable bash functions written in 2013-2018 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr
|
## Generic and highly portable bash functions written in 2013-2019 by Orsiris de Jong - http://www.netpower.fr - ozy@netpower.fr
|
||||||
|
|
||||||
#TODO: ExecTasks postponed arrays / files grow a lot. Consider having them "rolling" (cleaned at numberOfEvents)
|
#TODO: ExecTasks postponed arrays / files grow a lot. Consider having them "rolling" (cleaned at numberOfEvents)
|
||||||
#TODO: command line arguments don't take -AaqV for example
|
#TODO: command line arguments don't take -AaqV for example
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
#### OFUNCTIONS MINI SUBSET ####
|
#### OFUNCTIONS MINI SUBSET ####
|
||||||
#### OFUNCTIONS MICRO SUBSET ####
|
#### OFUNCTIONS MICRO SUBSET ####
|
||||||
_OFUNCTIONS_VERSION=2.3.0-RC2
|
_OFUNCTIONS_VERSION=2.3.0-RC2
|
||||||
_OFUNCTIONS_BUILD=2018122103
|
_OFUNCTIONS_BUILD=20190110
|
||||||
#### _OFUNCTIONS_BOOTSTRAP SUBSET ####
|
#### _OFUNCTIONS_BOOTSTRAP SUBSET ####
|
||||||
_OFUNCTIONS_BOOTSTRAP=true
|
_OFUNCTIONS_BOOTSTRAP=true
|
||||||
#### _OFUNCTIONS_BOOTSTRAP SUBSET END ####
|
#### _OFUNCTIONS_BOOTSTRAP SUBSET END ####
|
||||||
|
@ -66,12 +66,12 @@ WARN_ALERT=false
|
||||||
|
|
||||||
#### DEBUG SUBSET ####
|
#### DEBUG SUBSET ####
|
||||||
## allow function call checks #__WITH_PARANOIA_DEBUG
|
## allow function call checks #__WITH_PARANOIA_DEBUG
|
||||||
if [ "$_PARANOIA_DEBUG" == "yes" ];then #__WITH_PARANOIA_DEBUG
|
if [ "$_PARANOIA_DEBUG" == true ];then #__WITH_PARANOIA_DEBUG
|
||||||
_DEBUG=yes #__WITH_PARANOIA_DEBUG
|
_DEBUG=yes #__WITH_PARANOIA_DEBUG
|
||||||
fi #__WITH_PARANOIA_DEBUG
|
fi #__WITH_PARANOIA_DEBUG
|
||||||
|
|
||||||
## allow debugging from command line with _DEBUG=yes
|
## allow debugging from command line with _DEBUG=yes
|
||||||
if [ ! "$_DEBUG" == "yes" ]; then
|
if [ ! "$_DEBUG" == true ]; then
|
||||||
_DEBUG=no
|
_DEBUG=no
|
||||||
_LOGGER_VERBOSE=false
|
_LOGGER_VERBOSE=false
|
||||||
else
|
else
|
||||||
|
@ -226,19 +226,19 @@ function RemoteLogger {
|
||||||
|
|
||||||
if [ "$level" == "CRITICAL" ]; then
|
if [ "$level" == "CRITICAL" ]; then
|
||||||
_Logger "" "$prefix\e[1;33;41m$value\e[0m" true
|
_Logger "" "$prefix\e[1;33;41m$value\e[0m" true
|
||||||
if [ $_DEBUG == "yes" ]; then
|
if [ $_DEBUG == true ]; then
|
||||||
_Logger -e "" "[$retval] in [$(joinString , ${FUNCNAME[@]})] SP=$SCRIPT_PID P=$$" true
|
_Logger -e "" "[$retval] in [$(joinString , ${FUNCNAME[@]})] SP=$SCRIPT_PID P=$$" true
|
||||||
fi
|
fi
|
||||||
return
|
return
|
||||||
elif [ "$level" == "ERROR" ]; then
|
elif [ "$level" == "ERROR" ]; then
|
||||||
_Logger "" "$prefix\e[31m$value\e[0m" true
|
_Logger "" "$prefix\e[31m$value\e[0m" true
|
||||||
if [ $_DEBUG == "yes" ]; then
|
if [ $_DEBUG == true ]; then
|
||||||
_Logger -e "" "[$retval] in [$(joinString , ${FUNCNAME[@]})] SP=$SCRIPT_PID P=$$" true
|
_Logger -e "" "[$retval] in [$(joinString , ${FUNCNAME[@]})] SP=$SCRIPT_PID P=$$" true
|
||||||
fi
|
fi
|
||||||
return
|
return
|
||||||
elif [ "$level" == "WARN" ]; then
|
elif [ "$level" == "WARN" ]; then
|
||||||
_Logger "" "$prefix\e[33m$value\e[0m" true
|
_Logger "" "$prefix\e[33m$value\e[0m" true
|
||||||
if [ $_DEBUG == "yes" ]; then
|
if [ $_DEBUG == true ]; then
|
||||||
_Logger -e "" "[$retval] in [$(joinString , ${FUNCNAME[@]})] SP=$SCRIPT_PID P=$$" true
|
_Logger -e "" "[$retval] in [$(joinString , ${FUNCNAME[@]})] SP=$SCRIPT_PID P=$$" true
|
||||||
fi
|
fi
|
||||||
return
|
return
|
||||||
|
@ -256,12 +256,12 @@ function RemoteLogger {
|
||||||
_Logger "" "$prefix$value"
|
_Logger "" "$prefix$value"
|
||||||
return
|
return
|
||||||
elif [ "$level" == "DEBUG" ]; then
|
elif [ "$level" == "DEBUG" ]; then
|
||||||
if [ "$_DEBUG" == "yes" ]; then
|
if [ "$_DEBUG" == true ]; then
|
||||||
_Logger "" "$prefix$value"
|
_Logger "" "$prefix$value"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
elif [ "$level" == "PARANOIA_DEBUG" ]; then #__WITH_PARANOIA_DEBUG
|
elif [ "$level" == "PARANOIA_DEBUG" ]; then #__WITH_PARANOIA_DEBUG
|
||||||
if [ "$_PARANOIA_DEBUG" == "yes" ]; then #__WITH_PARANOIA_DEBUG
|
if [ "$_PARANOIA_DEBUG" == true ]; then #__WITH_PARANOIA_DEBUG
|
||||||
_Logger "" "$prefix\e[35m$value\e[0m" #__WITH_PARANOIA_DEBUG
|
_Logger "" "$prefix\e[35m$value\e[0m" #__WITH_PARANOIA_DEBUG
|
||||||
return #__WITH_PARANOIA_DEBUG
|
return #__WITH_PARANOIA_DEBUG
|
||||||
fi #__WITH_PARANOIA_DEBUG
|
fi #__WITH_PARANOIA_DEBUG
|
||||||
|
@ -337,12 +337,12 @@ function Logger {
|
||||||
_Logger "$prefix$value" "$prefix$value"
|
_Logger "$prefix$value" "$prefix$value"
|
||||||
return
|
return
|
||||||
elif [ "$level" == "DEBUG" ]; then
|
elif [ "$level" == "DEBUG" ]; then
|
||||||
if [ "$_DEBUG" == "yes" ]; then
|
if [ "$_DEBUG" == true ]; then
|
||||||
_Logger "$prefix$value" "$prefix$value"
|
_Logger "$prefix$value" "$prefix$value"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
elif [ "$level" == "PARANOIA_DEBUG" ]; then #__WITH_PARANOIA_DEBUG
|
elif [ "$level" == "PARANOIA_DEBUG" ]; then #__WITH_PARANOIA_DEBUG
|
||||||
if [ "$_PARANOIA_DEBUG" == "yes" ]; then #__WITH_PARANOIA_DEBUG
|
if [ "$_PARANOIA_DEBUG" == true ]; then #__WITH_PARANOIA_DEBUG
|
||||||
_Logger "$prefix$value" "$prefix\e[35m$value\e[0m" #__WITH_PARANOIA_DEBUG
|
_Logger "$prefix$value" "$prefix\e[35m$value\e[0m" #__WITH_PARANOIA_DEBUG
|
||||||
return #__WITH_PARANOIA_DEBUG
|
return #__WITH_PARANOIA_DEBUG
|
||||||
fi #__WITH_PARANOIA_DEBUG
|
fi #__WITH_PARANOIA_DEBUG
|
||||||
|
@ -451,7 +451,7 @@ function KillAllChilds {
|
||||||
|
|
||||||
#### CleanUp SUBSET ####
|
#### CleanUp SUBSET ####
|
||||||
function CleanUp {
|
function CleanUp {
|
||||||
if [ "$_DEBUG" != "yes" ]; then
|
if [ "$_DEBUG" != true ]; then
|
||||||
rm -f "$RUN_DIR/$PROGRAM."*".$SCRIPT_PID.$TSTAMP"
|
rm -f "$RUN_DIR/$PROGRAM."*".$SCRIPT_PID.$TSTAMP"
|
||||||
# Fix for sed -i requiring backup extension for BSD & Mac (see all sed -i statements)
|
# Fix for sed -i requiring backup extension for BSD & Mac (see all sed -i statements)
|
||||||
rm -f "$RUN_DIR/$PROGRAM."*".$SCRIPT_PID.$TSTAMP.tmp"
|
rm -f "$RUN_DIR/$PROGRAM."*".$SCRIPT_PID.$TSTAMP.tmp"
|
||||||
|
@ -494,7 +494,7 @@ function SendAlert {
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$_DEBUG" == "yes" ]; then
|
if [ "$_DEBUG" == true ]; then
|
||||||
Logger "Debug mode, no warning mail will be sent." "NOTICE"
|
Logger "Debug mode, no warning mail will be sent." "NOTICE"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
@ -756,7 +756,7 @@ function LoadConfigFile {
|
||||||
else
|
else
|
||||||
revisionPresent=$(GetConfFileValue "$configFile" "CONFIG_FILE_REVISION" true)
|
revisionPresent=$(GetConfFileValue "$configFile" "CONFIG_FILE_REVISION" true)
|
||||||
if [ "$(IsNumeric $revisionPresent)" -eq 0 ]; then
|
if [ "$(IsNumeric $revisionPresent)" -eq 0 ]; then
|
||||||
revisionPresent=0
|
Logger "CONFIG_FILE_REVISION does not seem numeric [$revisionPresent]." "DEBUG"
|
||||||
fi
|
fi
|
||||||
if [ "$revisionRequired" != "" ]; then
|
if [ "$revisionRequired" != "" ]; then
|
||||||
if [ $(VerComp "$revisionPresent" "$revisionRequired") -eq 2 ]; then
|
if [ $(VerComp "$revisionPresent" "$revisionRequired") -eq 2 ]; then
|
||||||
|
@ -898,7 +898,7 @@ function ExecTasks {
|
||||||
Logger "${FUNCNAME[0]} id [$id] called by [${FUNCNAME[1]} < ${FUNCNAME[2]} < ${FUNCNAME[3]} < ${FUNCNAME[4]} < ${FUNCNAME[5]} < ${FUNCNAME[6]} ...]." "PARANOIA_DEBUG" #__WITH_PARANOIA_DEBUG
|
Logger "${FUNCNAME[0]} id [$id] called by [${FUNCNAME[1]} < ${FUNCNAME[2]} < ${FUNCNAME[3]} < ${FUNCNAME[4]} < ${FUNCNAME[5]} < ${FUNCNAME[6]} ...]." "PARANOIA_DEBUG" #__WITH_PARANOIA_DEBUG
|
||||||
|
|
||||||
# Since ExecTasks takes up to 17 arguments, do a quick preflight check in DEBUG mode
|
# Since ExecTasks takes up to 17 arguments, do a quick preflight check in DEBUG mode
|
||||||
if [ "$_DEBUG" == "yes" ]; then
|
if [ "$_DEBUG" == true ]; then
|
||||||
declare -a booleans=(readFromFile counting spinner noTimeErrorLog noErrorLogsAtAll)
|
declare -a booleans=(readFromFile counting spinner noTimeErrorLog noErrorLogsAtAll)
|
||||||
for i in "${booleans[@]}"; do
|
for i in "${booleans[@]}"; do
|
||||||
test="if [ \$$i != false ] && [ \$$i != true ]; then Logger \"Bogus $i value [\$$i] given to ${FUNCNAME[0]}.\" \"CRITICAL\"; exit 1; fi"
|
test="if [ \$$i != false ] && [ \$$i != true ]; then Logger \"Bogus $i value [\$$i] given to ${FUNCNAME[0]}.\" \"CRITICAL\"; exit 1; fi"
|
||||||
|
@ -1145,7 +1145,7 @@ function ExecTasks {
|
||||||
# Trivial wait time for bash to not eat up all CPU
|
# Trivial wait time for bash to not eat up all CPU
|
||||||
sleep $sleepTime
|
sleep $sleepTime
|
||||||
|
|
||||||
if [ "$_PERF_PROFILER" == "yes" ]; then ##__WITH_PARANOIA_DEBUG
|
if [ "$_PERF_PROFILER" == true ]; then ##__WITH_PARANOIA_DEBUG
|
||||||
_PerfProfiler ##__WITH_PARANOIA_DEBUG
|
_PerfProfiler ##__WITH_PARANOIA_DEBUG
|
||||||
fi ##__WITH_PARANOIA_DEBUG
|
fi ##__WITH_PARANOIA_DEBUG
|
||||||
|
|
||||||
|
@ -1512,7 +1512,7 @@ function GetLocalOS {
|
||||||
LOCAL_OS="BusyBox"
|
LOCAL_OS="BusyBox"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
if [ "$IGNORE_OS_TYPE" == "yes" ]; then
|
if [ "$IGNORE_OS_TYPE" == true ]; then
|
||||||
Logger "Running on unknown local OS [$localOsVar]." "WARN"
|
Logger "Running on unknown local OS [$localOsVar]." "WARN"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
@ -1570,7 +1570,7 @@ function GetLocalOS {
|
||||||
function __CheckArguments {
|
function __CheckArguments {
|
||||||
# Checks the number of arguments of a function and raises an error if some are missing
|
# Checks the number of arguments of a function and raises an error if some are missing
|
||||||
|
|
||||||
if [ "$_DEBUG" == "yes" ]; then
|
if [ "$_DEBUG" == true ]; then
|
||||||
local numberOfArguments="${1}" # Number of arguments the tested function should have, can be a number of a range, eg 0-2 for zero to two arguments
|
local numberOfArguments="${1}" # Number of arguments the tested function should have, can be a number of a range, eg 0-2 for zero to two arguments
|
||||||
local numberOfGivenArguments="${2}" # Number of arguments that have been passed
|
local numberOfGivenArguments="${2}" # Number of arguments that have been passed
|
||||||
|
|
||||||
|
@ -1627,7 +1627,7 @@ function __CheckArguments {
|
||||||
function GetRemoteOS {
|
function GetRemoteOS {
|
||||||
__CheckArguments 0 $# "$@" #__WITH_PARANOIA_DEBUG
|
__CheckArguments 0 $# "$@" #__WITH_PARANOIA_DEBUG
|
||||||
|
|
||||||
if [ "$REMOTE_OPERATION" != "yes" ]; then
|
if [ "$REMOTE_OPERATION" != true ]; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -1744,7 +1744,7 @@ ENDSSH
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
if [ "$IGNORE_OS_TYPE" == "yes" ]; then #DOC: Undocumented debug only setting
|
if [ "$IGNORE_OS_TYPE" == true ]; then #DOC: Undocumented debug only setting
|
||||||
Logger "Running on unknown remote OS [$remoteOsVar]." "WARN"
|
Logger "Running on unknown remote OS [$remoteOsVar]." "WARN"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
@ -1784,7 +1784,7 @@ function RunLocalCommand {
|
||||||
Logger "Command output:\n$(cat $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP)" "NOTICE"
|
Logger "Command output:\n$(cat $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP)" "NOTICE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$STOP_ON_CMD_ERROR" == "yes" ] && [ $retval -ne 0 ]; then
|
if [ "$STOP_ON_CMD_ERROR" == true ] && [ $retval -ne 0 ]; then
|
||||||
Logger "Stopping on command execution error." "CRITICAL"
|
Logger "Stopping on command execution error." "CRITICAL"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -1797,7 +1797,7 @@ function RunRemoteCommand {
|
||||||
__CheckArguments 2 $# "$@" #__WITH_PARANOIA_DEBUG
|
__CheckArguments 2 $# "$@" #__WITH_PARANOIA_DEBUG
|
||||||
|
|
||||||
|
|
||||||
if [ "$REMOTE_OPERATION" != "yes" ]; then
|
if [ "$REMOTE_OPERATION" != true ]; then
|
||||||
Logger "Ignoring remote command [$command] because remote host is not configured." "WARN"
|
Logger "Ignoring remote command [$command] because remote host is not configured." "WARN"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
@ -1827,7 +1827,7 @@ function RunRemoteCommand {
|
||||||
Logger "Command output:\n$(cat $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP)" "NOTICE"
|
Logger "Command output:\n$(cat $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP)" "NOTICE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$STOP_ON_CMD_ERROR" == "yes" ] && [ $retval -ne 0 ]; then
|
if [ "$STOP_ON_CMD_ERROR" == true ] && [ $retval -ne 0 ]; then
|
||||||
Logger "Stopping on command execution error." "CRITICAL"
|
Logger "Stopping on command execution error." "CRITICAL"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -1878,9 +1878,9 @@ function CheckConnectivityRemoteHost {
|
||||||
|
|
||||||
local retval
|
local retval
|
||||||
|
|
||||||
if [ "$_PARANOIA_DEBUG" != "yes" ]; then # Do not loose time in paranoia debug #__WITH_PARANOIA_DEBUG
|
if [ "$_PARANOIA_DEBUG" != true ]; then # Do not loose time in paranoia debug #__WITH_PARANOIA_DEBUG
|
||||||
|
|
||||||
if [ "$REMOTE_HOST_PING" != "no" ] && [ "$REMOTE_OPERATION" != "no" ]; then
|
if [ "$REMOTE_HOST_PING" != false ] && [ "$REMOTE_OPERATION" != false ]; then
|
||||||
eval "$PING_CMD $REMOTE_HOST > /dev/null 2>&1" &
|
eval "$PING_CMD $REMOTE_HOST > /dev/null 2>&1" &
|
||||||
ExecTasks $! "${FUNCNAME[0]}" false 0 0 60 180 true $SLEEP_TIME $KEEP_LOGGING
|
ExecTasks $! "${FUNCNAME[0]}" false 0 0 60 180 true $SLEEP_TIME $KEEP_LOGGING
|
||||||
#ExecTasks "${FUNCNAME[0]}" 0 0 60 180 $SLEEP_TIME $KEEP_LOGGING true true false false 1 $!
|
#ExecTasks "${FUNCNAME[0]}" 0 0 60 180 $SLEEP_TIME $KEEP_LOGGING true true false false 1 $!
|
||||||
|
@ -1900,7 +1900,7 @@ function CheckConnectivity3rdPartyHosts {
|
||||||
local retval
|
local retval
|
||||||
local i
|
local i
|
||||||
|
|
||||||
if [ "$_PARANOIA_DEBUG" != "yes" ]; then # Do not loose time in paranoia debug #__WITH_PARANOIA_DEBUG
|
if [ "$_PARANOIA_DEBUG" != true ]; then # Do not loose time in paranoia debug #__WITH_PARANOIA_DEBUG
|
||||||
|
|
||||||
if [ "$REMOTE_3RD_PARTY_HOSTS" != "" ]; then
|
if [ "$REMOTE_3RD_PARTY_HOSTS" != "" ]; then
|
||||||
remote3rdPartySuccess=false
|
remote3rdPartySuccess=false
|
||||||
|
@ -2013,14 +2013,14 @@ function PreInit {
|
||||||
local compressionString
|
local compressionString
|
||||||
|
|
||||||
## SSH compression
|
## SSH compression
|
||||||
if [ "$SSH_COMPRESSION" != "no" ]; then
|
if [ "$SSH_COMPRESSION" != false ]; then
|
||||||
SSH_COMP=-C
|
SSH_COMP=-C
|
||||||
else
|
else
|
||||||
SSH_COMP=
|
SSH_COMP=
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## Ignore SSH known host verification
|
## Ignore SSH known host verification
|
||||||
if [ "$SSH_IGNORE_KNOWN_HOSTS" == "yes" ]; then
|
if [ "$SSH_IGNORE_KNOWN_HOSTS" == true ]; then
|
||||||
SSH_OPTS="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
|
SSH_OPTS="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -2030,7 +2030,7 @@ function PreInit {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
## Sudo execution option
|
## Sudo execution option
|
||||||
if [ "$SUDO_EXEC" == "yes" ]; then
|
if [ "$SUDO_EXEC" == true ]; then
|
||||||
if [ "$RSYNC_REMOTE_PATH" != "" ]; then
|
if [ "$RSYNC_REMOTE_PATH" != "" ]; then
|
||||||
RSYNC_PATH="sudo $RSYNC_REMOTE_PATH/$RSYNC_EXECUTABLE"
|
RSYNC_PATH="sudo $RSYNC_REMOTE_PATH/$RSYNC_EXECUTABLE"
|
||||||
else
|
else
|
||||||
|
@ -2194,19 +2194,19 @@ function InitRemoteOSDependingSettings {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
RSYNC_ATTR_ARGS=""
|
RSYNC_ATTR_ARGS=""
|
||||||
if [ "$PRESERVE_PERMISSIONS" != "no" ]; then
|
if [ "$PRESERVE_PERMISSIONS" != false ]; then
|
||||||
RSYNC_ATTR_ARGS=$RSYNC_ATTR_ARGS" -p"
|
RSYNC_ATTR_ARGS=$RSYNC_ATTR_ARGS" -p"
|
||||||
fi
|
fi
|
||||||
if [ "$PRESERVE_OWNER" != "no" ]; then
|
if [ "$PRESERVE_OWNER" != false ]; then
|
||||||
RSYNC_ATTR_ARGS=$RSYNC_ATTR_ARGS" -o"
|
RSYNC_ATTR_ARGS=$RSYNC_ATTR_ARGS" -o"
|
||||||
fi
|
fi
|
||||||
if [ "$PRESERVE_GROUP" != "no" ]; then
|
if [ "$PRESERVE_GROUP" != false ]; then
|
||||||
RSYNC_ATTR_ARGS=$RSYNC_ATTR_ARGS" -g"
|
RSYNC_ATTR_ARGS=$RSYNC_ATTR_ARGS" -g"
|
||||||
fi
|
fi
|
||||||
if [ "$PRESERVE_EXECUTABILITY" != "no" ]; then
|
if [ "$PRESERVE_EXECUTABILITY" != false ]; then
|
||||||
RSYNC_ATTR_ARGS=$RSYNC_ATTR_ARGS" --executability"
|
RSYNC_ATTR_ARGS=$RSYNC_ATTR_ARGS" --executability"
|
||||||
fi
|
fi
|
||||||
if [ "$PRESERVE_ACL" == "yes" ]; then
|
if [ "$PRESERVE_ACL" == true ]; then
|
||||||
if [ "$LOCAL_OS" != "MacOSX" ] && [ "$REMOTE_OS" != "MacOSX" ] && [ "$LOCAL_OS" != "msys" ] && [ "$REMOTE_OS" != "msys" ] && [ "$LOCAL_OS" != "Cygwin" ] && [ "$REMOTE_OS" != "Cygwin" ] && [ "$LOCAL_OS" != "BusyBox" ] && [ "$REMOTE_OS" != "BusyBox" ] && [ "$LOCAL_OS" != "Android" ] && [ "$REMOTE_OS" != "Android" ]; then
|
if [ "$LOCAL_OS" != "MacOSX" ] && [ "$REMOTE_OS" != "MacOSX" ] && [ "$LOCAL_OS" != "msys" ] && [ "$REMOTE_OS" != "msys" ] && [ "$LOCAL_OS" != "Cygwin" ] && [ "$REMOTE_OS" != "Cygwin" ] && [ "$LOCAL_OS" != "BusyBox" ] && [ "$REMOTE_OS" != "BusyBox" ] && [ "$LOCAL_OS" != "Android" ] && [ "$REMOTE_OS" != "Android" ]; then
|
||||||
RSYNC_ATTR_ARGS=$RSYNC_ATTR_ARGS" -A"
|
RSYNC_ATTR_ARGS=$RSYNC_ATTR_ARGS" -A"
|
||||||
else
|
else
|
||||||
|
@ -2214,45 +2214,45 @@ function InitRemoteOSDependingSettings {
|
||||||
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ "$PRESERVE_XATTR" == "yes" ]; then
|
if [ "$PRESERVE_XATTR" == true ]; then
|
||||||
if [ "$LOCAL_OS" != "MacOSX" ] && [ "$REMOTE_OS" != "MacOSX" ] && [ "$LOCAL_OS" != "msys" ] && [ "$REMOTE_OS" != "msys" ] && [ "$LOCAL_OS" != "Cygwin" ] && [ "$REMOTE_OS" != "Cygwin" ] && [ "$LOCAL_OS" != "BusyBox" ] && [ "$REMOTE_OS" != "BusyBox" ]; then
|
if [ "$LOCAL_OS" != "MacOSX" ] && [ "$REMOTE_OS" != "MacOSX" ] && [ "$LOCAL_OS" != "msys" ] && [ "$REMOTE_OS" != "msys" ] && [ "$LOCAL_OS" != "Cygwin" ] && [ "$REMOTE_OS" != "Cygwin" ] && [ "$LOCAL_OS" != "BusyBox" ] && [ "$REMOTE_OS" != "BusyBox" ]; then
|
||||||
RSYNC_ATTR_ARGS=$RSYNC_ATTR_ARGS" -X"
|
RSYNC_ATTR_ARGS=$RSYNC_ATTR_ARGS" -X"
|
||||||
else
|
else
|
||||||
Logger "Disabling extended attributes synchronization on [$LOCAL_OS] due to lack of support." "NOTICE"
|
Logger "Disabling extended attributes synchronization on [$LOCAL_OS] due to lack of support." "NOTICE"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ "$RSYNC_COMPRESS" == "yes" ]; then
|
if [ "$RSYNC_COMPRESS" == true ]; then
|
||||||
if [ "$LOCAL_OS" != "MacOSX" ] && [ "$REMOTE_OS" != "MacOSX" ]; then
|
if [ "$LOCAL_OS" != "MacOSX" ] && [ "$REMOTE_OS" != "MacOSX" ]; then
|
||||||
RSYNC_DEFAULT_ARGS=$RSYNC_DEFAULT_ARGS" -zz --skip-compress=gz/xz/lz/lzma/lzo/rz/jpg/mp3/mp4/7z/bz2/rar/zip/sfark/s7z/ace/apk/arc/cab/dmg/jar/kgb/lzh/lha/lzx/pak/sfx"
|
RSYNC_DEFAULT_ARGS=$RSYNC_DEFAULT_ARGS" -zz --skip-compress=gz/xz/lz/lzma/lzo/rz/jpg/mp3/mp4/7z/bz2/rar/zip/sfark/s7z/ace/apk/arc/cab/dmg/jar/kgb/lzh/lha/lzx/pak/sfx"
|
||||||
else
|
else
|
||||||
Logger "Disabling compression skips on synchronization on [$LOCAL_OS] due to lack of support." "NOTICE"
|
Logger "Disabling compression skips on synchronization on [$LOCAL_OS] due to lack of support." "NOTICE"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
if [ "$COPY_SYMLINKS" == "yes" ]; then
|
if [ "$COPY_SYMLINKS" == true ]; then
|
||||||
RSYNC_DEFAULT_ARGS=$RSYNC_DEFAULT_ARGS" -L"
|
RSYNC_DEFAULT_ARGS=$RSYNC_DEFAULT_ARGS" -L"
|
||||||
fi
|
fi
|
||||||
if [ "$KEEP_DIRLINKS" == "yes" ]; then
|
if [ "$KEEP_DIRLINKS" == true ]; then
|
||||||
RSYNC_DEFAULT_ARGS=$RSYNC_DEFAULT_ARGS" -K"
|
RSYNC_DEFAULT_ARGS=$RSYNC_DEFAULT_ARGS" -K"
|
||||||
fi
|
fi
|
||||||
if [ "$RSYNC_OPTIONAL_ARGS" != "" ]; then
|
if [ "$RSYNC_OPTIONAL_ARGS" != "" ]; then
|
||||||
RSYNC_DEFAULT_ARGS=$RSYNC_DEFAULT_ARGS" "$RSYNC_OPTIONAL_ARGS
|
RSYNC_DEFAULT_ARGS=$RSYNC_DEFAULT_ARGS" "$RSYNC_OPTIONAL_ARGS
|
||||||
fi
|
fi
|
||||||
if [ "$PRESERVE_HARDLINKS" == "yes" ]; then
|
if [ "$PRESERVE_HARDLINKS" == true ]; then
|
||||||
RSYNC_DEFAULT_ARGS=$RSYNC_DEFAULT_ARGS" -H"
|
RSYNC_DEFAULT_ARGS=$RSYNC_DEFAULT_ARGS" -H"
|
||||||
fi
|
fi
|
||||||
if [ "$CHECKSUM" == "yes" ]; then
|
if [ "$CHECKSUM" == true ]; then
|
||||||
RSYNC_TYPE_ARGS=$RSYNC_TYPE_ARGS" --checksum"
|
RSYNC_TYPE_ARGS=$RSYNC_TYPE_ARGS" --checksum"
|
||||||
fi
|
fi
|
||||||
if [ "$BANDWIDTH" != "" ] && [ "$BANDWIDTH" != "0" ]; then
|
if [ "$BANDWIDTH" != "" ] && [ "$BANDWIDTH" != "0" ]; then
|
||||||
RSYNC_DEFAULT_ARGS=$RSYNC_DEFAULT_ARGS" --bwlimit=$BANDWIDTH"
|
RSYNC_DEFAULT_ARGS=$RSYNC_DEFAULT_ARGS" --bwlimit=$BANDWIDTH"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$PARTIAL" == "yes" ]; then
|
if [ "$PARTIAL" == true ]; then
|
||||||
RSYNC_DEFAULT_ARGS=$RSYNC_DEFAULT_ARGS" --partial --partial-dir=\"$PARTIAL_DIR\""
|
RSYNC_DEFAULT_ARGS=$RSYNC_DEFAULT_ARGS" --partial --partial-dir=\"$PARTIAL_DIR\""
|
||||||
RSYNC_PARTIAL_EXCLUDE="--exclude=\"$PARTIAL_DIR\""
|
RSYNC_PARTIAL_EXCLUDE="--exclude=\"$PARTIAL_DIR\""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$DELTA_COPIES" != "no" ]; then
|
if [ "$DELTA_COPIES" != false ]; then
|
||||||
RSYNC_DEFAULT_ARGS=$RSYNC_DEFAULT_ARGS" --no-whole-file"
|
RSYNC_DEFAULT_ARGS=$RSYNC_DEFAULT_ARGS" --no-whole-file"
|
||||||
else
|
else
|
||||||
RSYNC_DEFAULT_ARGS=$RSYNC_DEFAULT_ARGS" --whole-file"
|
RSYNC_DEFAULT_ARGS=$RSYNC_DEFAULT_ARGS" --whole-file"
|
||||||
|
|
|
@ -2,9 +2,10 @@
|
||||||
|
|
||||||
###### osync - Rsync based two way sync engine with fault tolerance
|
###### osync - Rsync based two way sync engine with fault tolerance
|
||||||
###### (C) 2013-2016 by Orsiris de Jong (www.netpower.fr)
|
###### (C) 2013-2016 by Orsiris de Jong (www.netpower.fr)
|
||||||
###### osync v1.1x / v1.2x config file rev 2017060501
|
|
||||||
|
|
||||||
## ---------- GENERAL OPTIONS
|
|
||||||
|
[GENERAL]
|
||||||
|
CONFIG_FILE_REVISION=1.3.0
|
||||||
|
|
||||||
## Sync job identification
|
## Sync job identification
|
||||||
INSTANCE_ID="local"
|
INSTANCE_ID="local"
|
||||||
|
@ -27,7 +28,7 @@ SSH_PASSWORD_FILE=""
|
||||||
_REMOTE_TOKEN=SomeAlphaNumericToken9
|
_REMOTE_TOKEN=SomeAlphaNumericToken9
|
||||||
|
|
||||||
## Create sync directories if they do not exist
|
## Create sync directories if they do not exist
|
||||||
CREATE_DIRS=no
|
CREATE_DIRS=false
|
||||||
|
|
||||||
## Log file location. Leaving this empty will create a logfile at /var/log/osync_version_SYNC_ID.log (or current directory if /var/log doesn't exist)
|
## Log file location. Leaving this empty will create a logfile at /var/log/osync_version_SYNC_ID.log (or current directory if /var/log doesn't exist)
|
||||||
LOGFILE=""
|
LOGFILE=""
|
||||||
|
@ -39,7 +40,7 @@ MINIMUM_SPACE=10240
|
||||||
BANDWIDTH=0
|
BANDWIDTH=0
|
||||||
|
|
||||||
## If enabled, synchronization on remote system will be processed as superuser. See documentation for /etc/sudoers file configuration.
|
## If enabled, synchronization on remote system will be processed as superuser. See documentation for /etc/sudoers file configuration.
|
||||||
SUDO_EXEC=no
|
SUDO_EXEC=false
|
||||||
## Paranoia option. Don't change this unless you read the documentation.
|
## Paranoia option. Don't change this unless you read the documentation.
|
||||||
RSYNC_EXECUTABLE=rsync
|
RSYNC_EXECUTABLE=rsync
|
||||||
## Remote rsync executable path. Leave this empty in most cases
|
## Remote rsync executable path. Leave this empty in most cases
|
||||||
|
@ -64,23 +65,23 @@ RSYNC_EXCLUDE_FROM=""
|
||||||
## List elements separator char. You may set an alternative separator char for your directories lists above.
|
## List elements separator char. You may set an alternative separator char for your directories lists above.
|
||||||
PATH_SEPARATOR_CHAR=";"
|
PATH_SEPARATOR_CHAR=";"
|
||||||
|
|
||||||
## ---------- REMOTE SYNC OPTIONS
|
[REMOTE_OPTIONS]
|
||||||
|
|
||||||
## ssh compression should be used unless your remote connection is good enough (LAN)
|
## ssh compression should be used unless your remote connection is good enough (LAN)
|
||||||
SSH_COMPRESSION=yes
|
SSH_COMPRESSION=true
|
||||||
|
|
||||||
## Ignore ssh known hosts. DANGER WILL ROBINSON DANGER ! This can lead to security issues. Only enable this if you know what you're doing.
|
## Ignore ssh known hosts. DANGER WILL ROBINSON DANGER ! This can lead to security issues. Only enable this if you know what you're doing.
|
||||||
SSH_IGNORE_KNOWN_HOSTS=no
|
SSH_IGNORE_KNOWN_HOSTS=false
|
||||||
|
|
||||||
## Check for connectivity to remote host before launching remote sync task. Be sure the hosts responds to ping. Failing to ping will stop sync.
|
## Check for connectivity to remote host before launching remote sync task. Be sure the hosts responds to ping. Failing to ping will stop sync.
|
||||||
REMOTE_HOST_PING=no
|
REMOTE_HOST_PING=false
|
||||||
|
|
||||||
## Check for internet access by pinging one or more 3rd party hosts before remote sync task. Leave empty if you don't want this check to be be performed. Failing to ping will stop sync.
|
## Check for internet access by pinging one or more 3rd party hosts before remote sync task. Leave empty if you don't want this check to be be performed. Failing to ping will stop sync.
|
||||||
## If you use this function, you should set more than one 3rd party host, and be sure you can ping them.
|
## If you use this function, you should set more than one 3rd party host, and be sure you can ping them.
|
||||||
## Be aware some DNS like opendns redirect false hostnames. Also, this adds an extra execution time of a bit less than a minute.
|
## Be aware some DNS like opendns redirect false hostnames. Also, this adds an extra execution time of a bit less than a minute.
|
||||||
REMOTE_3RD_PARTY_HOSTS="www.kernel.org www.google.com"
|
REMOTE_3RD_PARTY_HOSTS="www.kernel.org www.google.com"
|
||||||
|
|
||||||
## ---------- MISC OPTIONS
|
[MISC_OPTIONS]
|
||||||
|
|
||||||
## Optional arguments passed to rsync executable. The following are already managed by the program and shoul never be passed here
|
## Optional arguments passed to rsync executable. The following are already managed by the program and shoul never be passed here
|
||||||
## -r -l -p -t -g -o -D -E - u- i- n --executability -A -X -L -K -H -8 -zz –skip-compress –checksum –bwlimit –partial –partial-dir –no-whole-file –whole-file –backup –backup-dir –suffix
|
## -r -l -p -t -g -o -D -E - u- i- n --executability -A -X -L -K -H -8 -zz –skip-compress –checksum –bwlimit –partial –partial-dir –no-whole-file –whole-file –backup –backup-dir –suffix
|
||||||
|
@ -88,27 +89,27 @@ REMOTE_3RD_PARTY_HOSTS="www.kernel.org www.google.com"
|
||||||
RSYNC_OPTIONAL_ARGS=""
|
RSYNC_OPTIONAL_ARGS=""
|
||||||
|
|
||||||
## Preserve basic linux permissions
|
## Preserve basic linux permissions
|
||||||
PRESERVE_PERMISSIONS=yes
|
PRESERVE_PERMISSIONS=true
|
||||||
PRESERVE_OWNER=yes
|
PRESERVE_OWNER=true
|
||||||
PRESERVE_GROUP=yes
|
PRESERVE_GROUP=true
|
||||||
## On MACOS X, does not work and will be ignored
|
## On MACOS X, does not work and will be ignored
|
||||||
PRESERVE_EXECUTABILITY=yes
|
PRESERVE_EXECUTABILITY=true
|
||||||
|
|
||||||
## Preserve ACLS. Make sure source and target FS can manage same ACLs or you'll get loads of errors.
|
## Preserve ACLS. Make sure source and target FS can manage same ACLs or you'll get loads of errors.
|
||||||
PRESERVE_ACL=yes
|
PRESERVE_ACL=false
|
||||||
## Preserve Xattr. Make sure source and target FS can manage same Xattrs or you'll get loads of errors.
|
## Preserve Xattr. Make sure source and target FS can manage same Xattrs or you'll get loads of errors.
|
||||||
PRESERVE_XATTR=yes
|
PRESERVE_XATTR=false
|
||||||
## Transforms symlinks into referent files/dirs
|
## Transforms symlinks into referent files/dirs
|
||||||
COPY_SYMLINKS=no
|
COPY_SYMLINKS=false
|
||||||
## Treat symlinked dirs as dirs. CAUTION: This also follows symlinks outside of the replica root.
|
## Treat symlinked dirs as dirs. CAUTION: This also follows symlinks outside of the replica root.
|
||||||
KEEP_DIRLINKS=no
|
KEEP_DIRLINKS=false
|
||||||
## Preserve hard links. Make sure source and target FS can manage hard links or you will lose them.
|
## Preserve hard links. Make sure source and target FS can manage hard links or you will lose them.
|
||||||
PRESERVE_HARDLINKS=no
|
PRESERVE_HARDLINKS=false
|
||||||
## Do a full checksum on all files that have identical sizes, they are checksummed to see if they actually are identical. This can take a long time.
|
## Do a full checksum on all files that have identical sizes, they are checksummed to see if they actually are identical. This can take a long time.
|
||||||
CHECKSUM=no
|
CHECKSUM=false
|
||||||
|
|
||||||
## Let RSYNC compress file transfers. Do not use this if both initator and target replicas are on local system. Also, do not use this if you already enabled SSH compression.
|
## Let RSYNC compress file transfers. Do not use this if both initator and target replicas are on local system. Also, do not use this if you already enabled SSH compression.
|
||||||
RSYNC_COMPRESS=yes
|
RSYNC_COMPRESS=true
|
||||||
|
|
||||||
## Maximum execution time (in seconds) for sync process. Set these values zero will disable max execution times.
|
## Maximum execution time (in seconds) for sync process. Set these values zero will disable max execution times.
|
||||||
## Soft exec time only generates a warning. Hard exec time will generate a warning and stop sync process.
|
## Soft exec time only generates a warning. Hard exec time will generate a warning and stop sync process.
|
||||||
|
@ -125,45 +126,45 @@ MIN_WAIT=60
|
||||||
## Use 0 to wait indefinitely.
|
## Use 0 to wait indefinitely.
|
||||||
MAX_WAIT=7200
|
MAX_WAIT=7200
|
||||||
|
|
||||||
## ---------- BACKUP AND DELETION OPTIONS
|
[BACKUP_DELETE_OPTIONS]
|
||||||
|
|
||||||
## Log a list of conflictual files
|
## Log a list of conflictual files
|
||||||
LOG_CONFLICTS=yes
|
LOG_CONFLICTS=true
|
||||||
## Send an email when conflictual files are found (implies LOG_CONFLICTS)
|
## Send an email when conflictual files are found (implies LOG_CONFLICTS)
|
||||||
ALERT_CONFLICTS=no
|
ALERT_CONFLICTS=false
|
||||||
## Enabling this option will keep a backup of a file on the target replica if it gets updated from the source replica. Backups will be made to .osync_workdir/backups
|
## Enabling this option will keep a backup of a file on the target replica if it gets updated from the source replica. Backups will be made to .osync_workdir/backups
|
||||||
CONFLICT_BACKUP=yes
|
CONFLICT_BACKUP=true
|
||||||
## Keep multiple backup versions of the same file. Warning, This can be very space consuming.
|
## Keep multiple backup versions of the same file. Warning, This can be very space consuming.
|
||||||
CONFLICT_BACKUP_MULTIPLE=no
|
CONFLICT_BACKUP_MULTIPLE=false
|
||||||
## Osync will clean backup files after a given number of days. Setting this to 0 will disable cleaning and keep backups forever. Warning: This can be very space consuming.
|
## Osync will clean backup files after a given number of days. Setting this to 0 will disable cleaning and keep backups forever. Warning: This can be very space consuming.
|
||||||
CONFLICT_BACKUP_DAYS=30
|
CONFLICT_BACKUP_DAYS=30
|
||||||
## If the same file exists on both replicas, newer version will be synced. However, if both files have the same timestamp but differ, CONFILCT_PREVALANCE sets winner replica.
|
## If the same file exists on both replicas, newer version will be synced. However, if both files have the same timestamp but differ, CONFILCT_PREVALANCE sets winner replica.
|
||||||
CONFLICT_PREVALANCE=initiator
|
CONFLICT_PREVALANCE=initiator
|
||||||
|
|
||||||
## On deletion propagation to the target replica, a backup of the deleted files can be kept. Deletions will be kept in .osync_workdir/deleted
|
## On deletion propagation to the target replica, a backup of the deleted files can be kept. Deletions will be kept in .osync_workdir/deleted
|
||||||
SOFT_DELETE=yes
|
SOFT_DELETE=true
|
||||||
## Osync will clean deleted files after a given number of days. Setting this to 0 will disable cleaning and keep deleted files forever. Warning: This can be very space consuming.
|
## Osync will clean deleted files after a given number of days. Setting this to 0 will disable cleaning and keep deleted files forever. Warning: This can be very space consuming.
|
||||||
SOFT_DELETE_DAYS=30
|
SOFT_DELETE_DAYS=30
|
||||||
|
|
||||||
## Optional deletion skip on replicas. Valid values are "initiator", "target", or "initiator,target"
|
## Optional deletion skip on replicas. Valid values are "initiator", "target", or "initiator,target"
|
||||||
SKIP_DELETION=
|
SKIP_DELETION=
|
||||||
|
|
||||||
## ---------- RESUME OPTIONS
|
[RESUME_OPTIONS]
|
||||||
|
|
||||||
## Try to resume an aborted sync task
|
## Try to resume an aborted sync task
|
||||||
RESUME_SYNC=yes
|
RESUME_SYNC=true
|
||||||
## Number maximum resume tries before initiating a fresh sync.
|
## Number maximum resume tries before initiating a fresh sync.
|
||||||
RESUME_TRY=2
|
RESUME_TRY=2
|
||||||
## When a pidlock exists on slave replica that does not correspond to the initiator's instance-id, force pidlock removal. Be careful with this option if you have multiple initiators.
|
## When a pidlock exists on slave replica that does not correspond to the initiator's instance-id, force pidlock removal. Be careful with this option if you have multiple initiators.
|
||||||
FORCE_STRANGER_LOCK_RESUME=no
|
FORCE_STRANGER_LOCK_RESUME=false
|
||||||
|
|
||||||
## Keep partial uploads that can be resumed on next run, experimental feature
|
## Keep partial uploads that can be resumed on next run, experimental feature
|
||||||
PARTIAL=no
|
PARTIAL=false
|
||||||
|
|
||||||
## Use delta copy algortithm (usefull when local paths are network drives), defaults to yes
|
## Use delta copy algortithm (usefull when local paths are network drives), defaults to yes
|
||||||
DELTA_COPIES=yes
|
DELTA_COPIES=true
|
||||||
|
|
||||||
## ---------- ALERT OPTIONS
|
[ALERT_OPTIONS]
|
||||||
|
|
||||||
## List of alert mails separated by spaces
|
## List of alert mails separated by spaces
|
||||||
## Most Unix systems (including Win10 bash) have mail support out of the box
|
## Most Unix systems (including Win10 bash) have mail support out of the box
|
||||||
|
@ -187,7 +188,7 @@ SMTP_ENCRYPTION=none
|
||||||
SMTP_USER=
|
SMTP_USER=
|
||||||
SMTP_PASSWORD=
|
SMTP_PASSWORD=
|
||||||
|
|
||||||
## ---------- EXECUTION HOOKS
|
[EXECUTION_HOOKS]
|
||||||
|
|
||||||
## Commands can will be run before and / or after sync process (remote execution will only happen if REMOTE_OPERATION is set).
|
## Commands can will be run before and / or after sync process (remote execution will only happen if REMOTE_OPERATION is set).
|
||||||
LOCAL_RUN_BEFORE_CMD=""
|
LOCAL_RUN_BEFORE_CMD=""
|
||||||
|
@ -201,7 +202,7 @@ MAX_EXEC_TIME_PER_CMD_BEFORE=0
|
||||||
MAX_EXEC_TIME_PER_CMD_AFTER=0
|
MAX_EXEC_TIME_PER_CMD_AFTER=0
|
||||||
|
|
||||||
## Stops osync execution if one of the above commands fail
|
## Stops osync execution if one of the above commands fail
|
||||||
STOP_ON_CMD_ERROR=yes
|
STOP_ON_CMD_ERROR=true
|
||||||
|
|
||||||
## Run local and remote after sync commands even on failure
|
## Run local and remote after sync commands even on failure
|
||||||
RUN_AFTER_CMD_ON_ERROR=no
|
RUN_AFTER_CMD_ON_ERROR=false
|
||||||
|
|
|
@ -2,9 +2,10 @@
|
||||||
|
|
||||||
###### osync - Rsync based two way sync engine with fault tolerance
|
###### osync - Rsync based two way sync engine with fault tolerance
|
||||||
###### (C) 2013-2016 by Orsiris de Jong (www.netpower.fr)
|
###### (C) 2013-2016 by Orsiris de Jong (www.netpower.fr)
|
||||||
###### osync v1.1x / v1.2x config file rev 2017060601
|
|
||||||
|
|
||||||
## ---------- GENERAL OPTIONS
|
|
||||||
|
[GENERAL]
|
||||||
|
CONFIG_FILE_REVISION=1.3.0
|
||||||
|
|
||||||
## Sync job identification
|
## Sync job identification
|
||||||
INSTANCE_ID="remote"
|
INSTANCE_ID="remote"
|
||||||
|
@ -15,7 +16,7 @@ INITIATOR_SYNC_DIR="${HOME}/osync-tests/initiator"
|
||||||
|
|
||||||
## Target is the system osync synchronizes to (can be the same system as the initiator in case of local sync tasks). The target directory can be a local or remote path.
|
## Target is the system osync synchronizes to (can be the same system as the initiator in case of local sync tasks). The target directory can be a local or remote path.
|
||||||
#TARGET_SYNC_DIR="${HOME}/osync-tests/target"
|
#TARGET_SYNC_DIR="${HOME}/osync-tests/target"
|
||||||
TARGET_SYNC_DIR="ssh://root@localhost:49999/${HOME}/osync-tests/target"
|
TARGET_SYNC_DIR="ssh://root@localhost:44999/${HOME}/osync-tests/target"
|
||||||
|
|
||||||
## If the target system is remote, you can specify a RSA key (please use full path). If not defined, the default ~/.ssh/id_rsa will be used. See documentation for further information.
|
## If the target system is remote, you can specify a RSA key (please use full path). If not defined, the default ~/.ssh/id_rsa will be used. See documentation for further information.
|
||||||
SSH_RSA_PRIVATE_KEY="${HOME}/.ssh/id_rsa_local"
|
SSH_RSA_PRIVATE_KEY="${HOME}/.ssh/id_rsa_local"
|
||||||
|
@ -27,7 +28,7 @@ SSH_PASSWORD_FILE=""
|
||||||
_REMOTE_TOKEN=SomeAlphaNumericToken9
|
_REMOTE_TOKEN=SomeAlphaNumericToken9
|
||||||
|
|
||||||
## Create sync directories if they do not exist
|
## Create sync directories if they do not exist
|
||||||
CREATE_DIRS=no
|
CREATE_DIRS=false
|
||||||
|
|
||||||
## Log file location. Leaving this empty will create a logfile at /var/log/osync_version_SYNC_ID.log (or current directory if /var/log doesn't exist)
|
## Log file location. Leaving this empty will create a logfile at /var/log/osync_version_SYNC_ID.log (or current directory if /var/log doesn't exist)
|
||||||
LOGFILE=""
|
LOGFILE=""
|
||||||
|
@ -39,7 +40,7 @@ MINIMUM_SPACE=10240
|
||||||
BANDWIDTH=0
|
BANDWIDTH=0
|
||||||
|
|
||||||
## If enabled, synchronization on remote system will be processed as superuser. See documentation for /etc/sudoers file configuration.
|
## If enabled, synchronization on remote system will be processed as superuser. See documentation for /etc/sudoers file configuration.
|
||||||
SUDO_EXEC=no
|
SUDO_EXEC=false
|
||||||
## Paranoia option. Don't change this unless you read the documentation.
|
## Paranoia option. Don't change this unless you read the documentation.
|
||||||
RSYNC_EXECUTABLE=rsync
|
RSYNC_EXECUTABLE=rsync
|
||||||
## Remote rsync executable path. Leave this empty in most cases
|
## Remote rsync executable path. Leave this empty in most cases
|
||||||
|
@ -64,23 +65,23 @@ RSYNC_EXCLUDE_FROM=""
|
||||||
## List elements separator char. You may set an alternative separator char for your directories lists above.
|
## List elements separator char. You may set an alternative separator char for your directories lists above.
|
||||||
PATH_SEPARATOR_CHAR=";"
|
PATH_SEPARATOR_CHAR=";"
|
||||||
|
|
||||||
## ---------- REMOTE SYNC OPTIONS
|
[REMOTE_OPTIONS]
|
||||||
|
|
||||||
## ssh compression should be used unless your remote connection is good enough (LAN)
|
## ssh compression should be used unless your remote connection is good enough (LAN)
|
||||||
SSH_COMPRESSION=yes
|
SSH_COMPRESSION=true
|
||||||
|
|
||||||
## Ignore ssh known hosts. DANGER WILL ROBINSON DANGER ! This can lead to security issues. Only enable this if you know what you're doing.
|
## Ignore ssh known hosts. DANGER WILL ROBINSON DANGER ! This can lead to security issues. Only enable this if you know what you're doing.
|
||||||
SSH_IGNORE_KNOWN_HOSTS=no
|
SSH_IGNORE_KNOWN_HOSTS=false
|
||||||
|
|
||||||
## Check for connectivity to remote host before launching remote sync task. Be sure the hosts responds to ping. Failing to ping will stop sync.
|
## Check for connectivity to remote host before launching remote sync task. Be sure the hosts responds to ping. Failing to ping will stop sync.
|
||||||
REMOTE_HOST_PING=yes
|
REMOTE_HOST_PING=true
|
||||||
|
|
||||||
## Check for internet access by pinging one or more 3rd party hosts before remote sync task. Leave empty if you don't want this check to be be performed. Failing to ping will stop sync.
|
## Check for internet access by pinging one or more 3rd party hosts before remote sync task. Leave empty if you don't want this check to be be performed. Failing to ping will stop sync.
|
||||||
## If you use this function, you should set more than one 3rd party host, and be sure you can ping them.
|
## If you use this function, you should set more than one 3rd party host, and be sure you can ping them.
|
||||||
## Be aware some DNS like opendns redirect false hostnames. Also, this adds an extra execution time of a bit less than a minute.
|
## Be aware some DNS like opendns redirect false hostnames. Also, this adds an extra execution time of a bit less than a minute.
|
||||||
REMOTE_3RD_PARTY_HOSTS="www.kernel.org www.google.com"
|
REMOTE_3RD_PARTY_HOSTS="www.kernel.org www.google.com"
|
||||||
|
|
||||||
## ---------- MISC OPTIONS
|
[MISC_OPTIONS]
|
||||||
|
|
||||||
## Optional arguments passed to rsync executable. The following are already managed by the program and shoul never be passed here
|
## Optional arguments passed to rsync executable. The following are already managed by the program and shoul never be passed here
|
||||||
## -r -l -p -t -g -o -D -E - u- i- n --executability -A -X -L -K -H -8 -zz –skip-compress –checksum –bwlimit –partial –partial-dir –no-whole-file –whole-file –backup –backup-dir –suffix
|
## -r -l -p -t -g -o -D -E - u- i- n --executability -A -X -L -K -H -8 -zz –skip-compress –checksum –bwlimit –partial –partial-dir –no-whole-file –whole-file –backup –backup-dir –suffix
|
||||||
|
@ -88,27 +89,27 @@ REMOTE_3RD_PARTY_HOSTS="www.kernel.org www.google.com"
|
||||||
RSYNC_OPTIONAL_ARGS=""
|
RSYNC_OPTIONAL_ARGS=""
|
||||||
|
|
||||||
## Preserve basic linux permissions
|
## Preserve basic linux permissions
|
||||||
PRESERVE_PERMISSIONS=yes
|
PRESERVE_PERMISSIONS=true
|
||||||
PRESERVE_OWNER=yes
|
PRESERVE_OWNER=true
|
||||||
PRESERVE_GROUP=yes
|
PRESERVE_GROUP=true
|
||||||
## On MACOS X, does not work and will be ignored
|
## On MACOS X, does not work and will be ignored
|
||||||
PRESERVE_EXECUTABILITY=yes
|
PRESERVE_EXECUTABILITY=true
|
||||||
|
|
||||||
## Preserve ACLS. Make sure source and target FS can manage same ACLs or you'll get loads of errors.
|
## Preserve ACLS. Make sure source and target FS can manage same ACLs or you'll get loads of errors.
|
||||||
PRESERVE_ACL=yes
|
PRESERVE_ACL=false
|
||||||
## Preserve Xattr. Make sure source and target FS can manage same Xattrs or you'll get loads of errors.
|
## Preserve Xattr. Make sure source and target FS can manage same Xattrs or you'll get loads of errors.
|
||||||
PRESERVE_XATTR=yes
|
PRESERVE_XATTR=false
|
||||||
## Transforms symlinks into referent files/dirs
|
## Transforms symlinks into referent files/dirs
|
||||||
COPY_SYMLINKS=no
|
COPY_SYMLINKS=false
|
||||||
## Treat symlinked dirs as dirs. CAUTION: This also follows symlinks outside of the replica root.
|
## Treat symlinked dirs as dirs. CAUTION: This also follows symlinks outside of the replica root.
|
||||||
KEEP_DIRLINKS=no
|
KEEP_DIRLINKS=false
|
||||||
## Preserve hard links. Make sure source and target FS can manage hard links or you will lose them.
|
## Preserve hard links. Make sure source and target FS can manage hard links or you will lose them.
|
||||||
PRESERVE_HARDLINKS=no
|
PRESERVE_HARDLINKS=false
|
||||||
## Do a full checksum on all files that have identical sizes, they are checksummed to see if they actually are identical. This can take a long time.
|
## Do a full checksum on all files that have identical sizes, they are checksummed to see if they actually are identical. This can take a long time.
|
||||||
CHECKSUM=no
|
CHECKSUM=false
|
||||||
|
|
||||||
## Let RSYNC compress file transfers. Do not use this if both initator and target replicas are on local system. Also, do not use this if you already enabled SSH compression.
|
## Let RSYNC compress file transfers. Do not use this if both initator and target replicas are on local system. Also, do not use this if you already enabled SSH compression.
|
||||||
RSYNC_COMPRESS=yes
|
RSYNC_COMPRESS=true
|
||||||
|
|
||||||
## Maximum execution time (in seconds) for sync process. Set these values zero will disable max execution times.
|
## Maximum execution time (in seconds) for sync process. Set these values zero will disable max execution times.
|
||||||
## Soft exec time only generates a warning. Hard exec time will generate a warning and stop sync process.
|
## Soft exec time only generates a warning. Hard exec time will generate a warning and stop sync process.
|
||||||
|
@ -125,45 +126,45 @@ MIN_WAIT=60
|
||||||
## Use 0 to wait indefinitely.
|
## Use 0 to wait indefinitely.
|
||||||
MAX_WAIT=7200
|
MAX_WAIT=7200
|
||||||
|
|
||||||
## ---------- BACKUP AND DELETION OPTIONS
|
[BACKUP_DELETE_OPTIONS]
|
||||||
|
|
||||||
## Log a list of conflictual files
|
## Log a list of conflictual files
|
||||||
LOG_CONFLICTS=yes
|
LOG_CONFLICTS=true
|
||||||
## Send an email when conflictual files are found (implies LOG_CONFLICTS)
|
## Send an email when conflictual files are found (implies LOG_CONFLICTS)
|
||||||
ALERT_CONFLICTS=no
|
ALERT_CONFLICTS=false
|
||||||
## Enabling this option will keep a backup of a file on the target replica if it gets updated from the source replica. Backups will be made to .osync_workdir/backups
|
## Enabling this option will keep a backup of a file on the target replica if it gets updated from the source replica. Backups will be made to .osync_workdir/backups
|
||||||
CONFLICT_BACKUP=yes
|
CONFLICT_BACKUP=true
|
||||||
## Keep multiple backup versions of the same file. Warning, This can be very space consuming.
|
## Keep multiple backup versions of the same file. Warning, This can be very space consuming.
|
||||||
CONFLICT_BACKUP_MULTIPLE=no
|
CONFLICT_BACKUP_MULTIPLE=false
|
||||||
## Osync will clean backup files after a given number of days. Setting this to 0 will disable cleaning and keep backups forever. Warning: This can be very space consuming.
|
## Osync will clean backup files after a given number of days. Setting this to 0 will disable cleaning and keep backups forever. Warning: This can be very space consuming.
|
||||||
CONFLICT_BACKUP_DAYS=30
|
CONFLICT_BACKUP_DAYS=30
|
||||||
## If the same file exists on both replicas, newer version will be synced. However, if both files have the same timestamp but differ, CONFILCT_PREVALANCE sets winner replica.
|
## If the same file exists on both replicas, newer version will be synced. However, if both files have the same timestamp but differ, CONFILCT_PREVALANCE sets winner replica.
|
||||||
CONFLICT_PREVALANCE=initiator
|
CONFLICT_PREVALANCE=initiator
|
||||||
|
|
||||||
## On deletion propagation to the target replica, a backup of the deleted files can be kept. Deletions will be kept in .osync_workdir/deleted
|
## On deletion propagation to the target replica, a backup of the deleted files can be kept. Deletions will be kept in .osync_workdir/deleted
|
||||||
SOFT_DELETE=yes
|
SOFT_DELETE=true
|
||||||
## Osync will clean deleted files after a given number of days. Setting this to 0 will disable cleaning and keep deleted files forever. Warning: This can be very space consuming.
|
## Osync will clean deleted files after a given number of days. Setting this to 0 will disable cleaning and keep deleted files forever. Warning: This can be very space consuming.
|
||||||
SOFT_DELETE_DAYS=30
|
SOFT_DELETE_DAYS=30
|
||||||
|
|
||||||
## Optional deletion skip on replicas. Valid values are "initiator", "target", or "initiator,target"
|
## Optional deletion skip on replicas. Valid values are "initiator", "target", or "initiator,target"
|
||||||
SKIP_DELETION=
|
SKIP_DELETION=
|
||||||
|
|
||||||
## ---------- RESUME OPTIONS
|
[RESUME_OPTIONS]
|
||||||
|
|
||||||
## Try to resume an aborted sync task
|
## Try to resume an aborted sync task
|
||||||
RESUME_SYNC=yes
|
RESUME_SYNC=true
|
||||||
## Number maximum resume tries before initiating a fresh sync.
|
## Number maximum resume tries before initiating a fresh sync.
|
||||||
RESUME_TRY=2
|
RESUME_TRY=2
|
||||||
## When a pidlock exists on slave replica that does not correspond to the initiator's instance-id, force pidlock removal. Be careful with this option if you have multiple initiators.
|
## When a pidlock exists on slave replica that does not correspond to the initiator's instance-id, force pidlock removal. Be careful with this option if you have multiple initiators.
|
||||||
FORCE_STRANGER_LOCK_RESUME=no
|
FORCE_STRANGER_LOCK_RESUME=false
|
||||||
|
|
||||||
## Keep partial uploads that can be resumed on next run, experimental feature
|
## Keep partial uploads that can be resumed on next run, experimental feature
|
||||||
PARTIAL=no
|
PARTIAL=false
|
||||||
|
|
||||||
## Use delta copy algortithm (usefull when local paths are network drives), defaults to yes
|
## Use delta copy algortithm (usefull when local paths are network drives), defaults to yes
|
||||||
DELTA_COPIES=yes
|
DELTA_COPIES=true
|
||||||
|
|
||||||
## ---------- ALERT OPTIONS
|
[ALERT_OPTIONS]
|
||||||
|
|
||||||
## List of alert mails separated by spaces
|
## List of alert mails separated by spaces
|
||||||
## Most Unix systems (including Win10 bash) have mail support out of the box
|
## Most Unix systems (including Win10 bash) have mail support out of the box
|
||||||
|
@ -187,7 +188,7 @@ SMTP_ENCRYPTION=none
|
||||||
SMTP_USER=
|
SMTP_USER=
|
||||||
SMTP_PASSWORD=
|
SMTP_PASSWORD=
|
||||||
|
|
||||||
## ---------- EXECUTION HOOKS
|
[EXECUTION_HOOKS]
|
||||||
|
|
||||||
## Commands can will be run before and / or after sync process (remote execution will only happen if REMOTE_OPERATION is set).
|
## Commands can will be run before and / or after sync process (remote execution will only happen if REMOTE_OPERATION is set).
|
||||||
LOCAL_RUN_BEFORE_CMD=""
|
LOCAL_RUN_BEFORE_CMD=""
|
||||||
|
@ -201,7 +202,7 @@ MAX_EXEC_TIME_PER_CMD_BEFORE=0
|
||||||
MAX_EXEC_TIME_PER_CMD_AFTER=0
|
MAX_EXEC_TIME_PER_CMD_AFTER=0
|
||||||
|
|
||||||
## Stops osync execution if one of the above commands fail
|
## Stops osync execution if one of the above commands fail
|
||||||
STOP_ON_CMD_ERROR=yes
|
STOP_ON_CMD_ERROR=true
|
||||||
|
|
||||||
## Run local and remote after sync commands even on failure
|
## Run local and remote after sync commands even on failure
|
||||||
RUN_AFTER_CMD_ON_ERROR=no
|
RUN_AFTER_CMD_ON_ERROR=false
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# osync test suite 2019010201
|
# osync test suite 2019011001
|
||||||
|
|
||||||
|
|
||||||
# Allows the following environment variables
|
# Allows the following environment variables
|
||||||
|
@ -66,7 +66,7 @@ TMP_OLD_CONF="tmp.old.conf"
|
||||||
|
|
||||||
OSYNC_EXECUTABLE="$FAKEROOT/usr/local/bin/osync.sh"
|
OSYNC_EXECUTABLE="$FAKEROOT/usr/local/bin/osync.sh"
|
||||||
OSYNC_DEV_EXECUTABLE="dev/n_osync.sh"
|
OSYNC_DEV_EXECUTABLE="dev/n_osync.sh"
|
||||||
OSYNC_UPGRADE="upgrade-v1.0x-v1.2x.sh"
|
OSYNC_UPGRADE="upgrade-v1.0x-v1.3x.sh"
|
||||||
TMP_FILE="$DEV_DIR/tmp"
|
TMP_FILE="$DEV_DIR/tmp"
|
||||||
|
|
||||||
|
|
||||||
|
@ -181,21 +181,21 @@ function oneTimeSetUp () {
|
||||||
if [ "$TRAVIS_RUN" == true ]; then
|
if [ "$TRAVIS_RUN" == true ]; then
|
||||||
echo "Running with travis settings"
|
echo "Running with travis settings"
|
||||||
REMOTE_USER="travis"
|
REMOTE_USER="travis"
|
||||||
RHOST_PING="no"
|
RHOST_PING=false
|
||||||
SetConfFileValue "$CONF_DIR/$REMOTE_CONF" "REMOTE_3RD_PARTY_HOSTS" ""
|
SetConfFileValue "$CONF_DIR/$REMOTE_CONF" "REMOTE_3RD_PARTY_HOSTS" ""
|
||||||
SetConfFileValue "$CONF_DIR/$REMOTE_CONF" "REMOTE_HOST_PING" "no"
|
SetConfFileValue "$CONF_DIR/$REMOTE_CONF" "REMOTE_HOST_PING" false
|
||||||
|
|
||||||
SetConfFileValue "$CONF_DIR/$OLD_CONF" "REMOTE_3RD_PARTY_HOSTS" ""
|
SetConfFileValue "$CONF_DIR/$OLD_CONF" "REMOTE_3RD_PARTY_HOSTS" ""
|
||||||
SetConfFileValue "$CONF_DIR/$OLD_CONF" "REMOTE_HOST_PING" "no"
|
SetConfFileValue "$CONF_DIR/$OLD_CONF" "REMOTE_HOST_PING" false
|
||||||
else
|
else
|
||||||
echo "Running with local settings"
|
echo "Running with local settings"
|
||||||
REMOTE_USER="root"
|
REMOTE_USER="root"
|
||||||
RHOST_PING="yes"
|
RHOST_PING=true
|
||||||
SetConfFileValue "$CONF_DIR/$REMOTE_CONF" "REMOTE_3RD_PARTY_HOSTS" "\"www.kernel.org www.google.com\""
|
SetConfFileValue "$CONF_DIR/$REMOTE_CONF" "REMOTE_3RD_PARTY_HOSTS" "\"www.kernel.org www.google.com\""
|
||||||
SetConfFileValue "$CONF_DIR/$REMOTE_CONF" "REMOTE_HOST_PING" "yes"
|
SetConfFileValue "$CONF_DIR/$REMOTE_CONF" "REMOTE_HOST_PING" true
|
||||||
|
|
||||||
SetConfFileValue "$CONF_DIR/$OLD_CONF" "REMOTE_3RD_PARTY_HOSTS" "\"www.kernel.org www.google.com\""
|
SetConfFileValue "$CONF_DIR/$OLD_CONF" "REMOTE_3RD_PARTY_HOSTS" "\"www.kernel.org www.google.com\""
|
||||||
SetConfFileValue "$CONF_DIR/$OLD_CONF" "REMOTE_HOST_PING" "yes"
|
SetConfFileValue "$CONF_DIR/$OLD_CONF" "REMOTE_HOST_PING" true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get default ssh port from env
|
# Get default ssh port from env
|
||||||
|
@ -256,14 +256,14 @@ function oneTimeSetUp () {
|
||||||
SetConfFileValue "$CONF_DIR/$LOCAL_CONF" "SKIP_DELETION" ""
|
SetConfFileValue "$CONF_DIR/$LOCAL_CONF" "SKIP_DELETION" ""
|
||||||
SetConfFileValue "$CONF_DIR/$REMOTE_CONF" "SKIP_DELETION" ""
|
SetConfFileValue "$CONF_DIR/$REMOTE_CONF" "SKIP_DELETION" ""
|
||||||
|
|
||||||
SetConfFileValue "$CONF_DIR/$LOCAL_CONF" "COPY_SYMLINKS" "no"
|
SetConfFileValue "$CONF_DIR/$LOCAL_CONF" "COPY_SYMLINKS" false
|
||||||
SetConfFileValue "$CONF_DIR/$REMOTE_CONF" "COPY_SYMLINKS" "no"
|
SetConfFileValue "$CONF_DIR/$REMOTE_CONF" "COPY_SYMLINKS" false
|
||||||
|
|
||||||
SetConfFileValue "$CONF_DIR/$LOCAL_CONF" "CONFLICT_BACKUP_MULTIPLE" "no"
|
SetConfFileValue "$CONF_DIR/$LOCAL_CONF" "CONFLICT_BACKUP_MULTIPLE" false
|
||||||
SetConfFileValue "$CONF_DIR/$REMOTE_CONF" "CONFLICT_BACKUP_MULTIPLE" "no"
|
SetConfFileValue "$CONF_DIR/$REMOTE_CONF" "CONFLICT_BACKUP_MULTIPLE" false
|
||||||
|
|
||||||
SetConfFileValue "$CONF_DIR/$LOCAL_CONF" "FORCE_STRANGER_LOCK_RESUME" "no"
|
SetConfFileValue "$CONF_DIR/$LOCAL_CONF" "FORCE_STRANGER_LOCK_RESUME" false
|
||||||
SetConfFileValue "$CONF_DIR/$REMOTE_CONF" "FORCE_STRANGER_LOCK_RESUME" "no"
|
SetConfFileValue "$CONF_DIR/$REMOTE_CONF" "FORCE_STRANGER_LOCK_RESUME" false
|
||||||
|
|
||||||
SetConfFileValue "$CONF_DIR/$REMOTE_CONF" "SOFT_MAX_EXEC_TIME" "7200"
|
SetConfFileValue "$CONF_DIR/$REMOTE_CONF" "SOFT_MAX_EXEC_TIME" "7200"
|
||||||
SetConfFileValue "$CONF_DIR/$REMOTE_CONF" "HARD_MAX_EXEC_TIME" "10600"
|
SetConfFileValue "$CONF_DIR/$REMOTE_CONF" "HARD_MAX_EXEC_TIME" "10600"
|
||||||
|
@ -318,11 +318,11 @@ function test_Merge () {
|
||||||
# Don't use SetConfFileValue here since for whatever reason Travis does not like creating a sed temporary file in $FAKEROOT
|
# Don't use SetConfFileValue here since for whatever reason Travis does not like creating a sed temporary file in $FAKEROOT
|
||||||
|
|
||||||
if [ "$TRAVIS_RUN" == true ]; then
|
if [ "$TRAVIS_RUN" == true ]; then
|
||||||
$SUDO_CMD sed -i.tmp 's/^IS_STABLE=.*/IS_STABLE=yes/' "$OSYNC_EXECUTABLE"
|
$SUDO_CMD sed -i.tmp 's/^IS_STABLE=.*/IS_STABLE=true/' "$OSYNC_EXECUTABLE"
|
||||||
else
|
else
|
||||||
sed -i.tmp 's/^IS_STABLE=.*/IS_STABLE=yes/' "$OSYNC_EXECUTABLE"
|
sed -i.tmp 's/^IS_STABLE=.*/IS_STABLE=true/' "$OSYNC_EXECUTABLE"
|
||||||
fi
|
fi
|
||||||
#SetConfFileValue "$OSYNC_EXECUTABLE" "IS_STABLE" "yes"
|
#SetConfFileValue "$OSYNC_EXECUTABLE" "IS_STABLE" true
|
||||||
|
|
||||||
|
|
||||||
assertEquals "Install failed" "0" $?
|
assertEquals "Install failed" "0" $?
|
||||||
|
@ -573,7 +573,7 @@ function test_handle_symlinks () {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check with and without copySymlinks
|
# Check with and without copySymlinks
|
||||||
copySymlinks="no"
|
copySymlinks=false
|
||||||
|
|
||||||
echo "Running with COPY_SYMLINKS=$copySymlinks"
|
echo "Running with COPY_SYMLINKS=$copySymlinks"
|
||||||
|
|
||||||
|
@ -660,7 +660,7 @@ function test_handle_symlinks () {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check with and without copySymlinks
|
# Check with and without copySymlinks
|
||||||
copySymlinks="yes"
|
copySymlinks=true
|
||||||
|
|
||||||
echo "Running with COPY_SYMLINKS=$copySymlinks"
|
echo "Running with COPY_SYMLINKS=$copySymlinks"
|
||||||
|
|
||||||
|
@ -938,8 +938,8 @@ function test_MultipleConflictBackups () {
|
||||||
local additionalParameters
|
local additionalParameters
|
||||||
|
|
||||||
# modify config files
|
# modify config files
|
||||||
SetConfFileValue "$CONF_DIR/$LOCAL_CONF" "CONFLICT_BACKUP_MULTIPLE" "yes"
|
SetConfFileValue "$CONF_DIR/$LOCAL_CONF" "CONFLICT_BACKUP_MULTIPLE" true
|
||||||
SetConfFileValue "$CONF_DIR/$REMOTE_CONF" "CONFLICT_BACKUP_MULTIPLE" "yes"
|
SetConfFileValue "$CONF_DIR/$REMOTE_CONF" "CONFLICT_BACKUP_MULTIPLE" true
|
||||||
|
|
||||||
if [ "$OSYNC_MIN_VERSION" != "1" ]; then
|
if [ "$OSYNC_MIN_VERSION" != "1" ]; then
|
||||||
additionalParameters="--errors-only --summary --no-prefix"
|
additionalParameters="--errors-only --summary --no-prefix"
|
||||||
|
@ -991,8 +991,8 @@ function test_MultipleConflictBackups () {
|
||||||
assertEquals "3 Backup files are present in [$TARGET_DIR/$OSYNC_BACKUP_DIR/]." "0" $?
|
assertEquals "3 Backup files are present in [$TARGET_DIR/$OSYNC_BACKUP_DIR/]." "0" $?
|
||||||
done
|
done
|
||||||
|
|
||||||
SetConfFileValue "$CONF_DIR/$LOCAL_CONF" "CONFLICT_BACKUP_MULTIPLE" "no"
|
SetConfFileValue "$CONF_DIR/$LOCAL_CONF" "CONFLICT_BACKUP_MULTIPLE" false
|
||||||
SetConfFileValue "$CONF_DIR/$REMOTE_CONF" "CONFLICT_BACKUP_MULTIPLE" "no"
|
SetConfFileValue "$CONF_DIR/$REMOTE_CONF" "CONFLICT_BACKUP_MULTIPLE" false
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_Locking () {
|
function test_Locking () {
|
||||||
|
@ -1083,8 +1083,8 @@ function test_Locking () {
|
||||||
|
|
||||||
# Target lock present should be resumed if instance ID is NOT the same as current one but FORCE_STRANGER_UNLOCK=yes
|
# Target lock present should be resumed if instance ID is NOT the same as current one but FORCE_STRANGER_UNLOCK=yes
|
||||||
|
|
||||||
SetConfFileValue "$CONF_DIR/$LOCAL_CONF" "FORCE_STRANGER_LOCK_RESUME" "yes"
|
SetConfFileValue "$CONF_DIR/$LOCAL_CONF" "FORCE_STRANGER_LOCK_RESUME" true
|
||||||
SetConfFileValue "$CONF_DIR/$REMOTE_CONF" "FORCE_STRANGER_LOCK_RESUME" "yes"
|
SetConfFileValue "$CONF_DIR/$REMOTE_CONF" "FORCE_STRANGER_LOCK_RESUME" true
|
||||||
|
|
||||||
for i in "${osyncParameters[@]}"; do
|
for i in "${osyncParameters[@]}"; do
|
||||||
|
|
||||||
|
@ -1098,8 +1098,8 @@ function test_Locking () {
|
||||||
assertEquals "Should be able to resume when target has lock with different instance id but FORCE_STRANGER_UNLOCK=yes." "0" $?
|
assertEquals "Should be able to resume when target has lock with different instance id but FORCE_STRANGER_UNLOCK=yes." "0" $?
|
||||||
done
|
done
|
||||||
|
|
||||||
SetConfFileValue "$CONF_DIR/$LOCAL_CONF" "FORCE_STRANGER_LOCK_RESUME" "no"
|
SetConfFileValue "$CONF_DIR/$LOCAL_CONF" "FORCE_STRANGER_LOCK_RESUME" false
|
||||||
SetConfFileValue "$CONF_DIR/$REMOTE_CONF" "FORCE_STRANGER_LOCK_RESUME" "no"
|
SetConfFileValue "$CONF_DIR/$REMOTE_CONF" "FORCE_STRANGER_LOCK_RESUME" false
|
||||||
}
|
}
|
||||||
|
|
||||||
function nope_test_ConflictDetetion () {
|
function nope_test_ConflictDetetion () {
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
###### osync - Rsync based two way sync engine with fault tolerance
|
###### osync - Rsync based two way sync engine with fault tolerance
|
||||||
###### (C) 2013-2017 by Orsiris de Jong (www.netpower.fr)
|
###### (C) 2013-2019 by Orsiris de Jong (www.netpower.fr)
|
||||||
###### osync v1.1x / v1.2x config file rev 2017060501
|
###### osync v1.1x / v2.0x config file rev 2019011001
|
||||||
|
|
||||||
## ---------- GENERAL OPTIONS
|
[GENERAL]
|
||||||
|
|
||||||
## Sync job identification
|
## Sync job identification
|
||||||
INSTANCE_ID="sync_test"
|
INSTANCE_ID="sync_test"
|
||||||
|
@ -26,8 +24,8 @@ SSH_PASSWORD_FILE=""
|
||||||
## When using ssh filter, you must specify a remote token matching the one setup in authorized_keys
|
## When using ssh filter, you must specify a remote token matching the one setup in authorized_keys
|
||||||
_REMOTE_TOKEN=SomeAlphaNumericToken9
|
_REMOTE_TOKEN=SomeAlphaNumericToken9
|
||||||
|
|
||||||
## Create sync directories if they do not exist
|
## Create sync directories if they do not exist (true/false)
|
||||||
CREATE_DIRS=no
|
CREATE_DIRS=true
|
||||||
|
|
||||||
## Log file location. Leaving this empty will create a logfile at /var/log/osync_version_SYNC_ID.log (or current directory if /var/log doesn't exist)
|
## Log file location. Leaving this empty will create a logfile at /var/log/osync_version_SYNC_ID.log (or current directory if /var/log doesn't exist)
|
||||||
LOGFILE=""
|
LOGFILE=""
|
||||||
|
@ -39,7 +37,7 @@ MINIMUM_SPACE=10240
|
||||||
BANDWIDTH=0
|
BANDWIDTH=0
|
||||||
|
|
||||||
## If enabled, synchronization on remote system will be processed as superuser. See documentation for /etc/sudoers file configuration.
|
## If enabled, synchronization on remote system will be processed as superuser. See documentation for /etc/sudoers file configuration.
|
||||||
SUDO_EXEC=no
|
SUDO_EXEC=false
|
||||||
## Paranoia option. Don't change this unless you read the documentation.
|
## Paranoia option. Don't change this unless you read the documentation.
|
||||||
RSYNC_EXECUTABLE=rsync
|
RSYNC_EXECUTABLE=rsync
|
||||||
## Remote rsync executable path. Leave this empty in most cases
|
## Remote rsync executable path. Leave this empty in most cases
|
||||||
|
@ -64,23 +62,23 @@ RSYNC_EXCLUDE_FROM=""
|
||||||
## List elements separator char. You may set an alternative separator char for your directories lists above.
|
## List elements separator char. You may set an alternative separator char for your directories lists above.
|
||||||
PATH_SEPARATOR_CHAR=";"
|
PATH_SEPARATOR_CHAR=";"
|
||||||
|
|
||||||
## ---------- REMOTE SYNC OPTIONS
|
[REMOTE_OPTIONS]
|
||||||
|
|
||||||
## ssh compression should be used unless your remote connection is good enough (LAN)
|
## ssh compression should be used unless your remote connection is good enough (LAN)
|
||||||
SSH_COMPRESSION=yes
|
SSH_COMPRESSION=true
|
||||||
|
|
||||||
## Ignore ssh known hosts. DANGER WILL ROBINSON DANGER ! This can lead to security issues. Only enable this if you know what you're doing.
|
## Ignore ssh known hosts. DANGER WILL ROBINSON DANGER ! This can lead to security issues. Only enable this if you know what you're doing.
|
||||||
SSH_IGNORE_KNOWN_HOSTS=no
|
SSH_IGNORE_KNOWN_HOSTS=false
|
||||||
|
|
||||||
## Check for connectivity to remote host before launching remote sync task. Be sure the hosts responds to ping. Failing to ping will stop sync.
|
## Check for connectivity to remote host before launching remote sync task. Be sure the hosts responds to ping. Failing to ping will stop sync.
|
||||||
REMOTE_HOST_PING=no
|
REMOTE_HOST_PING=false
|
||||||
|
|
||||||
## Check for internet access by pinging one or more 3rd party hosts before remote sync task. Leave empty if you don't want this check to be be performed. Failing to ping will stop sync.
|
## Check for internet access by pinging one or more 3rd party hosts before remote sync task. Leave empty if you don't want this check to be be performed. Failing to ping will stop sync.
|
||||||
## If you use this function, you should set more than one 3rd party host, and be sure you can ping them.
|
## If you use this function, you should set more than one 3rd party host, and be sure you can ping them.
|
||||||
## Be aware some DNS like opendns redirect false hostnames. Also, this adds an extra execution time of a bit less than a minute.
|
## Be aware some DNS like opendns redirect false hostnames. Also, this adds an extra execution time of a bit less than a minute.
|
||||||
REMOTE_3RD_PARTY_HOSTS="www.kernel.org www.google.com"
|
REMOTE_3RD_PARTY_HOSTS="www.kernel.org www.google.com"
|
||||||
|
|
||||||
## ---------- MISC OPTIONS
|
[MISC_OPTIONS]
|
||||||
|
|
||||||
## Optional arguments passed to rsync executable. The following are already managed by the program and shoul never be passed here
|
## Optional arguments passed to rsync executable. The following are already managed by the program and shoul never be passed here
|
||||||
## -r -l -p -t -g -o -D -E - u- i- n --executability -A -X -L -K -H -8 -zz –skip-compress –checksum –bwlimit –partial –partial-dir –no-whole-file –whole-file –backup –backup-dir –suffix
|
## -r -l -p -t -g -o -D -E - u- i- n --executability -A -X -L -K -H -8 -zz –skip-compress –checksum –bwlimit –partial –partial-dir –no-whole-file –whole-file –backup –backup-dir –suffix
|
||||||
|
@ -89,27 +87,27 @@ REMOTE_3RD_PARTY_HOSTS="www.kernel.org www.google.com"
|
||||||
RSYNC_OPTIONAL_ARGS=""
|
RSYNC_OPTIONAL_ARGS=""
|
||||||
|
|
||||||
## Preserve basic linux permissions
|
## Preserve basic linux permissions
|
||||||
PRESERVE_PERMISSIONS=yes
|
PRESERVE_PERMISSIONS=true
|
||||||
PRESERVE_OWNER=yes
|
PRESERVE_OWNER=true
|
||||||
PRESERVE_GROUP=yes
|
PRESERVE_GROUP=true
|
||||||
## On MACOS X, does not work and will be ignored
|
## On MACOS X, does not work and will be ignored
|
||||||
PRESERVE_EXECUTABILITY=yes
|
PRESERVE_EXECUTABILITY=true
|
||||||
|
|
||||||
## Preserve ACLS. Make sure source and target FS can handle ACL. Disabled on Mac OSX.
|
## Preserve ACLS. Make sure source and target FS can handle ACL. Disabled on Mac OSX.
|
||||||
PRESERVE_ACL=no
|
PRESERVE_ACL=false
|
||||||
## Preserve Xattr. Make sure source and target FS can manage identical XATTRS. Disabled on Mac OSX. Apparently, prior to rsync v3.1.2 there are some performance caveats with transferring XATTRS.
|
## Preserve Xattr. Make sure source and target FS can manage identical XATTRS. Disabled on Mac OSX. Apparently, prior to rsync v3.1.2 there are some performance caveats with transferring XATTRS.
|
||||||
PRESERVE_XATTR=no
|
PRESERVE_XATTR=false
|
||||||
## Transforms symlinks into referent files/dirs. Be careful as symlinks without referrent will break sync as if standard files could not be copied.
|
## Transforms symlinks into referent files/dirs. Be careful as symlinks without referrent will break sync as if standard files could not be copied.
|
||||||
COPY_SYMLINKS=no
|
COPY_SYMLINKS=false
|
||||||
## Treat symlinked dirs as dirs. CAUTION: This also follows symlinks outside of the replica root.
|
## Treat symlinked dirs as dirs. CAUTION: This also follows symlinks outside of the replica root.
|
||||||
KEEP_DIRLINKS=no
|
KEEP_DIRLINKS=false
|
||||||
## Preserve hard links. Make sure source and target FS can manage hard links or you will lose them.
|
## Preserve hard links. Make sure source and target FS can manage hard links or you will lose them.
|
||||||
PRESERVE_HARDLINKS=no
|
PRESERVE_HARDLINKS=false
|
||||||
## Do a full checksum on all files that have identical sizes, they are checksummed to see if they actually are identical. This can take a long time.
|
## Do a full checksum on all files that have identical sizes, they are checksummed to see if they actually are identical. This can take a long time.
|
||||||
CHECKSUM=no
|
CHECKSUM=false
|
||||||
|
|
||||||
## Let RSYNC compress file transfers. Do not use this if both initator and target replicas are on local system. Also, do not use this if you already enabled SSH compression.
|
## Let RSYNC compress file transfers. Do not use this if both initator and target replicas are on local system. Also, do not use this if you already enabled SSH compression.
|
||||||
RSYNC_COMPRESS=yes
|
RSYNC_COMPRESS=true
|
||||||
|
|
||||||
## Maximum execution time (in seconds) for sync process. Set these values zero will disable max execution times.
|
## Maximum execution time (in seconds) for sync process. Set these values zero will disable max execution times.
|
||||||
## Soft exec time only generates a warning. Hard exec time will generate a warning and stop sync process.
|
## Soft exec time only generates a warning. Hard exec time will generate a warning and stop sync process.
|
||||||
|
@ -126,45 +124,45 @@ MIN_WAIT=60
|
||||||
## Use 0 to wait indefinitely.
|
## Use 0 to wait indefinitely.
|
||||||
MAX_WAIT=7200
|
MAX_WAIT=7200
|
||||||
|
|
||||||
## ---------- BACKUP AND DELETION OPTIONS
|
[BACKUP_DELETE_OPTIONS]
|
||||||
|
|
||||||
## Log a list of conflictual files
|
## Log a list of conflictual files
|
||||||
LOG_CONFLICTS=yes
|
LOG_CONFLICTS=true
|
||||||
## Send an email when conflictual files are found (implies LOG_CONFLICTS)
|
## Send an email when conflictual files are found (implies LOG_CONFLICTS)
|
||||||
ALERT_CONFLICTS=no
|
ALERT_CONFLICTS=false
|
||||||
## Enabling this option will keep a backup of a file on the target replica if it gets updated from the source replica. Backups will be made to .osync_workdir/backups
|
## Enabling this option will keep a backup of a file on the target replica if it gets updated from the source replica. Backups will be made to .osync_workdir/backups
|
||||||
CONFLICT_BACKUP=yes
|
CONFLICT_BACKUP=true
|
||||||
## Keep multiple backup versions of the same file. Warning, This can be very space consuming.
|
## Keep multiple backup versions of the same file. Warning, This can be very space consuming.
|
||||||
CONFLICT_BACKUP_MULTIPLE=no
|
CONFLICT_BACKUP_MULTIPLE=false
|
||||||
## Osync will clean backup files after a given number of days. Setting this to 0 will disable cleaning and keep backups forever. Warning: This can be very space consuming.
|
## Osync will clean backup files after a given number of days. Setting this to 0 will disable cleaning and keep backups forever. Warning: This can be very space consuming.
|
||||||
CONFLICT_BACKUP_DAYS=30
|
CONFLICT_BACKUP_DAYS=30
|
||||||
## If the same file exists on both replicas, newer version will be synced. However, if both files have the same timestamp but differ, CONFILCT_PREVALANCE sets winner replica.
|
## If the same file exists on both replicas, newer version will be synced. However, if both files have the same timestamp but differ, CONFILCT_PREVALANCE sets winner replica.
|
||||||
CONFLICT_PREVALANCE=initiator
|
CONFLICT_PREVALANCE=initiator
|
||||||
|
|
||||||
## On deletion propagation to the target replica, a backup of the deleted files can be kept. Deletions will be kept in .osync_workdir/deleted
|
## On deletion propagation to the target replica, a backup of the deleted files can be kept. Deletions will be kept in .osync_workdir/deleted
|
||||||
SOFT_DELETE=yes
|
SOFT_DELETE=true
|
||||||
## Osync will clean deleted files after a given number of days. Setting this to 0 will disable cleaning and keep deleted files forever. Warning: This can be very space consuming.
|
## Osync will clean deleted files after a given number of days. Setting this to 0 will disable cleaning and keep deleted files forever. Warning: This can be very space consuming.
|
||||||
SOFT_DELETE_DAYS=30
|
SOFT_DELETE_DAYS=30
|
||||||
|
|
||||||
## Optional deletion skip on replicas. Valid values are "initiator", "target", or "initiator,target"
|
## Optional deletion skip on replicas. Valid values are "initiator", "target", or "initiator,target"
|
||||||
SKIP_DELETION=
|
SKIP_DELETION=
|
||||||
|
|
||||||
## ---------- RESUME OPTIONS
|
[RESUME_OPTIONS]
|
||||||
|
|
||||||
## Try to resume an aborted sync task
|
## Try to resume an aborted sync task
|
||||||
RESUME_SYNC=yes
|
RESUME_SYNC=true
|
||||||
## Number maximum resume tries before initiating a fresh sync.
|
## Number maximum resume tries before initiating a fresh sync.
|
||||||
RESUME_TRY=2
|
RESUME_TRY=2
|
||||||
## When a pidlock exists on slave replica that does not correspond to the initiator's instance-id, force pidlock removal. Be careful with this option if you have multiple initiators.
|
## When a pidlock exists on slave replica that does not correspond to the initiator's instance-id, force pidlock removal. Be careful with this option if you have multiple initiators.
|
||||||
FORCE_STRANGER_LOCK_RESUME=no
|
FORCE_STRANGER_LOCK_RESUME=false
|
||||||
|
|
||||||
## Keep partial uploads that can be resumed on next run, experimental feature
|
## Keep partial uploads that can be resumed on next run, experimental feature
|
||||||
PARTIAL=no
|
PARTIAL=false
|
||||||
|
|
||||||
## Use delta copy algortithm (usefull when local paths are network drives), defaults to yes
|
## Use delta copy algortithm (usefull when local paths are network drives), defaults to yes
|
||||||
DELTA_COPIES=yes
|
DELTA_COPIES=true
|
||||||
|
|
||||||
## ---------- ALERT OPTIONS
|
[ALERT_OPTIONS]
|
||||||
|
|
||||||
## List of alert mails separated by spaces
|
## List of alert mails separated by spaces
|
||||||
## Most Unix systems (including Win10 bash) have mail support out of the box
|
## Most Unix systems (including Win10 bash) have mail support out of the box
|
||||||
|
@ -184,11 +182,11 @@ SENDER_MAIL="alert@your.system.tld"
|
||||||
SMTP_SERVER=smtp.your.isp.tld
|
SMTP_SERVER=smtp.your.isp.tld
|
||||||
SMTP_PORT=25
|
SMTP_PORT=25
|
||||||
# encryption can be tls, ssl or none
|
# encryption can be tls, ssl or none
|
||||||
SMTP_ENCRYPTION=none
|
SMTP_ENCRYPTION=falsene
|
||||||
SMTP_USER=
|
SMTP_USER=
|
||||||
SMTP_PASSWORD=
|
SMTP_PASSWORD=
|
||||||
|
|
||||||
## ---------- EXECUTION HOOKS
|
[EXECUTION_HOOKS]
|
||||||
|
|
||||||
## Commands can will be run before and / or after sync process (remote execution will only happen if REMOTE_OPERATION is set).
|
## Commands can will be run before and / or after sync process (remote execution will only happen if REMOTE_OPERATION is set).
|
||||||
LOCAL_RUN_BEFORE_CMD=""
|
LOCAL_RUN_BEFORE_CMD=""
|
||||||
|
@ -202,7 +200,7 @@ MAX_EXEC_TIME_PER_CMD_BEFORE=0
|
||||||
MAX_EXEC_TIME_PER_CMD_AFTER=0
|
MAX_EXEC_TIME_PER_CMD_AFTER=0
|
||||||
|
|
||||||
## Stops osync execution if one of the above commands fail
|
## Stops osync execution if one of the above commands fail
|
||||||
STOP_ON_CMD_ERROR=yes
|
STOP_ON_CMD_ERROR=true
|
||||||
|
|
||||||
## Run local and remote after sync commands even on failure
|
## Run local and remote after sync commands even on failure
|
||||||
RUN_AFTER_CMD_ON_ERROR=no
|
RUN_AFTER_CMD_ON_ERROR=no
|
||||||
|
|
Loading…
Reference in New Issue