|
|
|
@ -4,7 +4,7 @@ PROGRAM="Osync" # Rsync based two way sync engine with fault tolerance
|
|
|
|
|
AUTHOR="(L) 2013-2015 by Orsiris \"Ozy\" de Jong"
|
|
|
|
|
CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr"
|
|
|
|
|
PROGRAM_VERSION=1.00pre
|
|
|
|
|
PROGRAM_BUILD=2606201501
|
|
|
|
|
PROGRAM_BUILD=2015062701
|
|
|
|
|
|
|
|
|
|
## type doesn't work on platforms other than linux (bash). If if doesn't work, always assume output is not a zero exitcode
|
|
|
|
|
if ! type -p "$BASH" > /dev/null
|
|
|
|
@ -1179,7 +1179,19 @@ function _delete_local
|
|
|
|
|
|
|
|
|
|
if [ $dryrun -ne 1 ]
|
|
|
|
|
then
|
|
|
|
|
mv "$REPLICA_DIR$files" "$REPLICA_DIR$3"
|
|
|
|
|
if [ -e "$REPLICA_DIR$3/$files" ]
|
|
|
|
|
then
|
|
|
|
|
rm -rf "$REPLICA_DIR$3/$files"
|
|
|
|
|
fi
|
|
|
|
|
# In order to keep full path on soft deletion, create parent directories before move
|
|
|
|
|
parentdir="$(dirname "$files")"
|
|
|
|
|
if [ "$parentdir" != "." ]
|
|
|
|
|
then
|
|
|
|
|
mkdir --parents "$REPLICA_DIR$3/$parentdir"
|
|
|
|
|
mv -f "$REPLICA_DIR$files" "$REPLICA_DIR$3/$parentdir"
|
|
|
|
|
else
|
|
|
|
|
mv -f "$REPLICA_DIR$files" "$REPLICA_DIR$3"
|
|
|
|
|
fi
|
|
|
|
|
if [ $? != 0 ]
|
|
|
|
|
then
|
|
|
|
|
LogError "Cannot move $REPLICA_DIR$files to deletion directory."
|
|
|
|
@ -1282,7 +1294,19 @@ $SSH_CMD error_alert=0 sync_on_changes=$sync_on_changes silent=$silent DEBUG=$DE
|
|
|
|
|
|
|
|
|
|
if [ $dryrun -ne 1 ]
|
|
|
|
|
then
|
|
|
|
|
$COMMAND_SUDO mv "$REPLICA_DIR$files" "$REPLICA_DIR$DELETE_DIR"
|
|
|
|
|
if [ -e "$REPLICA_DIR$DELETE_DIR/$files" ]
|
|
|
|
|
then
|
|
|
|
|
$COMMAND_SUDO rm -rf "$REPLICA_DIR$DELETE_DIR/$files"
|
|
|
|
|
fi
|
|
|
|
|
# In order to keep full path on soft deletion, create parent directories before move
|
|
|
|
|
parentdir="$(dirname "$files")"
|
|
|
|
|
if [ "$parentdir" != "." ]
|
|
|
|
|
then
|
|
|
|
|
$COMMAND_SUDO mkdir --parents "$REPLICA_DIR$DELETE_DIR/$parentdir"
|
|
|
|
|
$COMMAND_SUDO mv -f "$REPLICA_DIR$files" "$REPLICA_DIR$DELETE_DIR/$parentdir"
|
|
|
|
|
else
|
|
|
|
|
$COMMAND_SUDO mv -f "$REPLICA_DIR$files" "$REPLICA_DIR$DELETE_DIR"
|
|
|
|
|
fi
|
|
|
|
|
if [ $? != 0 ]
|
|
|
|
|
then
|
|
|
|
|
LogError "Cannot move $REPLICA_DIR$files to deletion directory."
|
|
|
|
|