Added SKIP_DELETION support
This commit is contained in:
parent
3ae961c4b9
commit
9c212c1bd1
|
@ -4,7 +4,7 @@ PROGRAM="osync" # Rsync based two way sync engine with fault tolerance
|
||||||
AUTHOR="(C) 2013-2016 by Orsiris de Jong"
|
AUTHOR="(C) 2013-2016 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.2-beta2
|
PROGRAM_VERSION=1.2-beta2
|
||||||
PROGRAM_BUILD=2016101704
|
PROGRAM_BUILD=2016102101
|
||||||
IS_STABLE=no
|
IS_STABLE=no
|
||||||
|
|
||||||
# Execution order #__WITH_PARANOIA_DEBUG
|
# Execution order #__WITH_PARANOIA_DEBUG
|
||||||
|
@ -170,6 +170,11 @@ function CheckCurrentConfigAll {
|
||||||
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
|
||||||
|
|
||||||
|
if [ "$SKIP_DELETION" != "" ] && [ $(arrayContains "${INITIATOR[$__type]}" "${SKIP_DELETION[@]}") -ne 0 ] && [ $(arrayContains "${TARGET[$__type]}" "${SKIP_DELETION[@]}") -ne 0 ]; then
|
||||||
|
Logger "Bogus skip deletion parameter." "CRITICAL"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
###### Osync specific functions (non shared)
|
###### Osync specific functions (non shared)
|
||||||
|
@ -1167,6 +1172,7 @@ function deletionPropagation {
|
||||||
#TODO: deletionPropagation replicaType = source replica whereas _deleteXxxxxx replicaType = dest replica
|
#TODO: deletionPropagation replicaType = source replica whereas _deleteXxxxxx replicaType = dest replica
|
||||||
|
|
||||||
if [ "$replicaType" == "${INITIATOR[$__type]}" ]; then
|
if [ "$replicaType" == "${INITIATOR[$__type]}" ]; then
|
||||||
|
if [ $(arrayContains "${INITIATOR[$__type]}" "${SKIP_DELETION[@]}") -ne 0 ]; then
|
||||||
replicaDir="${INITIATOR[$__replicaDir]}"
|
replicaDir="${INITIATOR[$__replicaDir]}"
|
||||||
deleteDir="${INITIATOR[$__deleteDir]}"
|
deleteDir="${INITIATOR[$__deleteDir]}"
|
||||||
|
|
||||||
|
@ -1177,6 +1183,10 @@ function deletionPropagation {
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
Logger "Skipping deletion on replica $replicaType." "NOTICE"
|
||||||
|
fi
|
||||||
|
elif [ "$replicaType" == "${TARGET[$__type]}" ]; then
|
||||||
|
if [ $(arrayContains "${TARGET[$__type]}" "${SKIP_DELETION[@]}") -ne 0 ]; then
|
||||||
replicaDir="${TARGET[$__replicaDir]}"
|
replicaDir="${TARGET[$__replicaDir]}"
|
||||||
deleteDir="${TARGET[$__deleteDir]}"
|
deleteDir="${TARGET[$__deleteDir]}"
|
||||||
|
|
||||||
|
@ -1198,6 +1208,9 @@ function deletionPropagation {
|
||||||
fi
|
fi
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
Logger "Skipping deletion on replica $replicaType." "NOTICE"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1847,6 +1860,7 @@ function Usage {
|
||||||
echo "--rsakey=\"\" Alternative path to rsa private key for ssh connection to target replica"
|
echo "--rsakey=\"\" Alternative path to rsa private key for ssh connection to target replica"
|
||||||
echo "--password-file=\"\" If no rsa private key is used for ssh authentication, a password file can be used"
|
echo "--password-file=\"\" If no rsa private key is used for ssh authentication, a password file can be used"
|
||||||
echo "--instance-id=\"\" Optional sync task name to identify this synchronization task when using multiple targets"
|
echo "--instance-id=\"\" Optional sync task name to identify this synchronization task when using multiple targets"
|
||||||
|
echo "--skip-deletion=\"\" You may skip deletion propagation on initiator or target. Valid values: initiator target initiator,target"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Additionaly, you may set most osync options at runtime. eg:"
|
echo "Additionaly, you may set most osync options at runtime. eg:"
|
||||||
echo "SOFT_DELETE_DAYS=365 osync.sh --initiator=/path --target=/other/path"
|
echo "SOFT_DELETE_DAYS=365 osync.sh --initiator=/path --target=/other/path"
|
||||||
|
@ -1983,6 +1997,11 @@ for i in "$@"; do
|
||||||
INSTANCE_ID=${i##*=}
|
INSTANCE_ID=${i##*=}
|
||||||
opts=$opts" --instance-id=\"$INSTANCE_ID\""
|
opts=$opts" --instance-id=\"$INSTANCE_ID\""
|
||||||
;;
|
;;
|
||||||
|
--skip-deletion=*)
|
||||||
|
#SKIP_DELETION=${i##*=}
|
||||||
|
opts=$opts" --skip-deletion=\"${i##*=}\""
|
||||||
|
IFS=',' read -r -a SKIP_DELETION <<< ${i##*=}
|
||||||
|
;;
|
||||||
--on-changes)
|
--on-changes)
|
||||||
sync_on_changes=true
|
sync_on_changes=true
|
||||||
_NOLOCKS=true
|
_NOLOCKS=true
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
###### 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 2016101901
|
###### osync v1.1x / v1.2x config file rev 2016102101
|
||||||
|
|
||||||
## ---------- GENERAL OPTIONS
|
## ---------- GENERAL OPTIONS
|
||||||
|
|
||||||
|
@ -133,6 +133,9 @@ SOFT_DELETE=yes
|
||||||
## 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"
|
||||||
|
SKIP_DELETION=
|
||||||
|
|
||||||
## ---------- RESUME OPTIONS
|
## ---------- RESUME OPTIONS
|
||||||
|
|
||||||
## Try to resume an aborted sync task
|
## Try to resume an aborted sync task
|
||||||
|
|
|
@ -6,7 +6,7 @@ AUTHOR="(C) 2016 by Orsiris de Jong"
|
||||||
CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr"
|
CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr"
|
||||||
OLD_PROGRAM_VERSION="v1.0x-v1.1x"
|
OLD_PROGRAM_VERSION="v1.0x-v1.1x"
|
||||||
NEW_PROGRAM_VERSION="v1.2x"
|
NEW_PROGRAM_VERSION="v1.2x"
|
||||||
CONFIG_FILE_VERSION=2016101901
|
CONFIG_FILE_VERSION=2016102101
|
||||||
PROGRAM_BUILD=2016101701
|
PROGRAM_BUILD=2016101701
|
||||||
|
|
||||||
## type -p does not work on platforms other than linux (bash). If if does not work, always assume output is not a zero exitcode
|
## type -p does not work on platforms other than linux (bash). If if does not work, always assume output is not a zero exitcode
|
||||||
|
@ -64,6 +64,7 @@ CONFLICT_BACKUP_DAYS
|
||||||
CONFLICT_PREVALANCE
|
CONFLICT_PREVALANCE
|
||||||
SOFT_DELETE
|
SOFT_DELETE
|
||||||
SOFT_DELETE_DAYS
|
SOFT_DELETE_DAYS
|
||||||
|
SKIP_DELETION
|
||||||
RESUME_SYNC
|
RESUME_SYNC
|
||||||
RESUME_TRY
|
RESUME_TRY
|
||||||
FORCE_STRANGER_LOCK_RESUME
|
FORCE_STRANGER_LOCK_RESUME
|
||||||
|
@ -130,6 +131,7 @@ no
|
||||||
initiator
|
initiator
|
||||||
yes
|
yes
|
||||||
30
|
30
|
||||||
|
''
|
||||||
yes
|
yes
|
||||||
2
|
2
|
||||||
no
|
no
|
||||||
|
|
Loading…
Reference in New Issue