Rebuild targets
This commit is contained in:
parent
010e171f50
commit
0d7aa043a2
|
@ -4,7 +4,7 @@ PROGRAM="osync" # Rsync based two way sync engine with fault tolerance
|
|||
AUTHOR="(C) 2013-2016 by Orsiris de Jong"
|
||||
CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr"
|
||||
PROGRAM_VERSION=1.1.1
|
||||
PROGRAM_BUILD=2016080104
|
||||
PROGRAM_BUILD=2016080106
|
||||
IS_STABLE=yes
|
||||
|
||||
## FUNC_BUILD=2016071902
|
||||
|
@ -2041,18 +2041,19 @@ function _delete_local {
|
|||
do
|
||||
if [[ "$files" != "$previous_file/"* ]] && [ "$files" != "" ]; then
|
||||
if [ "$SOFT_DELETE" != "no" ]; then
|
||||
if [ ! -d "$replica_dir$deletion_dir" ]; then
|
||||
mkdir -p "$replica_dir$deletion_dir"
|
||||
if [ $? != 0 ]; then
|
||||
Logger "Cannot create replica deletion directory." "ERROR"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $_VERBOSE -eq 1 ]; then
|
||||
Logger "Soft deleting $replica_dir$files" "NOTICE"
|
||||
fi
|
||||
|
||||
if [ $_DRYRUN -ne 1 ]; then
|
||||
if [ ! -d "$replica_dir$deletion_dir" ]; then
|
||||
mkdir -p "$replica_dir$deletion_dir"
|
||||
if [ $? != 0 ]; then
|
||||
Logger "Cannot create replica deletion directory." "ERROR"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -e "$replica_dir$deletion_dir/$files" ]; then
|
||||
rm -rf "${replica_dir:?}$deletion_dir/$files"
|
||||
fi
|
||||
|
@ -2108,7 +2109,7 @@ function _delete_remote {
|
|||
|
||||
# Additionnaly, we need to copy the deletetion list to the remote state folder
|
||||
esc_dest_dir="$(EscapeSpaces "${TARGET[1]}${TARGET[3]}")"
|
||||
rsync_cmd="$(type -p $RSYNC_EXECUTABLE) --rsync-path=\"$RSYNC_PATH\" $SYNC_OPTS -e \"$RSYNC_SSH_CMD\" \"${INITIATOR[1]}${INITIATOR[3]}/$deleted_list_file\" $REMOTE_USER@$REMOTE_HOST:\"$esc_dest_dir/\" > $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.precopy.$SCRIPT_PID 2>&1"
|
||||
rsync_cmd="$(type -p $RSYNC_EXECUTABLE) --rsync-path=\"$RSYNC_PATH\" -e \"$RSYNC_SSH_CMD\" \"${INITIATOR[1]}${INITIATOR[3]}/$deleted_list_file\" $REMOTE_USER@$REMOTE_HOST:\"$esc_dest_dir/\" > $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.precopy.$SCRIPT_PID 2>&1"
|
||||
Logger "RSYNC_CMD: $rsync_cmd" "DEBUG"
|
||||
eval "$rsync_cmd" 2>> "$LOG_FILE"
|
||||
if [ $? != 0 ]; then
|
||||
|
@ -2170,12 +2171,6 @@ $SSH_CMD ERROR_ALERT=0 sync_on_changes=$sync_on_changes _SILENT=$_SILENT _DEBUG=
|
|||
do
|
||||
Logger "Processing file [$file]." "DEBUG"
|
||||
if [[ "$files" != "$previous_file/"* ]] && [ "$files" != "" ]; then
|
||||
if [ ! -d "$REPLICA_DIR$DELETE_DIR" ]; then
|
||||
$COMMAND_SUDO mkdir -p "$REPLICA_DIR$DELETE_DIR"
|
||||
if [ $? != 0 ]; then
|
||||
Logger "Cannot create replica deletion directory." "ERROR"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$SOFT_DELETE" != "no" ]; then
|
||||
if [ $_VERBOSE -eq 1 ]; then
|
||||
|
@ -2183,6 +2178,14 @@ $SSH_CMD ERROR_ALERT=0 sync_on_changes=$sync_on_changes _SILENT=$_SILENT _DEBUG=
|
|||
fi
|
||||
|
||||
Logger "Full path for deletion is [$REPLICA_DIR$DELETE_DIR/$files]." "DEBUG"
|
||||
|
||||
if [ ! -d "$REPLICA_DIR$DELETE_DIR" ]; then
|
||||
$COMMAND_SUDO mkdir -p "$REPLICA_DIR$DELETE_DIR"
|
||||
if [ $? != 0 ]; then
|
||||
Logger "Cannot create replica deletion directory." "ERROR"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $_DRYRUN -ne 1 ]; then
|
||||
if [ -e "$REPLICA_DIR$DELETE_DIR/$files" ]; then
|
||||
$COMMAND_SUDO rm -rf "$REPLICA_DIR$DELETE_DIR/$files"
|
||||
|
@ -2195,7 +2198,7 @@ $SSH_CMD ERROR_ALERT=0 sync_on_changes=$sync_on_changes _SILENT=$_SILENT _DEBUG=
|
|||
$COMMAND_SUDO mkdir -p "$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"1
|
||||
$COMMAND_SUDO mv -f "$REPLICA_DIR$files" "$REPLICA_DIR$DELETE_DIR"
|
||||
fi
|
||||
if [ $? != 0 ]; then
|
||||
Logger "Cannot move $REPLICA_DIR$files to deletion directory." "ERROR"
|
||||
|
@ -2229,7 +2232,7 @@ ENDSSH
|
|||
|
||||
## Copy back the deleted failed file list
|
||||
esc_source_file="$(EscapeSpaces "${TARGET[1]}${TARGET[3]}/$deleted_failed_list_file")"
|
||||
rsync_cmd="$(type -p $RSYNC_EXECUTABLE) --rsync-path=\"$RSYNC_PATH\" $SYNC_OPTS -e \"$RSYNC_SSH_CMD\" $REMOTE_USER@$REMOTE_HOST:\"$esc_source_file\" \"${INITIATOR[1]}${INITIATOR[3]}\" > \"$RUN_DIR/$PROGRAM.remote_failed_deletion_list_copy.$SCRIPT_PID\""
|
||||
rsync_cmd="$(type -p $RSYNC_EXECUTABLE) --rsync-path=\"$RSYNC_PATH\" -e \"$RSYNC_SSH_CMD\" $REMOTE_USER@$REMOTE_HOST:\"$esc_source_file\" \"${INITIATOR[1]}${INITIATOR[3]}\" > \"$RUN_DIR/$PROGRAM.remote_failed_deletion_list_copy.$SCRIPT_PID\""
|
||||
Logger "RSYNC_CMD: $rsync_cmd" "DEBUG"
|
||||
eval "$rsync_cmd" 2>> "$LOG_FILE"
|
||||
if [ $? != 0 ]; then
|
||||
|
|
35
osync.sh
35
osync.sh
|
@ -4,7 +4,7 @@ PROGRAM="osync" # Rsync based two way sync engine with fault tolerance
|
|||
AUTHOR="(C) 2013-2016 by Orsiris de Jong"
|
||||
CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr"
|
||||
PROGRAM_VERSION=1.1.1
|
||||
PROGRAM_BUILD=2016080104
|
||||
PROGRAM_BUILD=2016080106
|
||||
IS_STABLE=yes
|
||||
|
||||
## FUNC_BUILD=2016071902
|
||||
|
@ -1940,18 +1940,19 @@ function _delete_local {
|
|||
do
|
||||
if [[ "$files" != "$previous_file/"* ]] && [ "$files" != "" ]; then
|
||||
if [ "$SOFT_DELETE" != "no" ]; then
|
||||
if [ ! -d "$replica_dir$deletion_dir" ]; then
|
||||
mkdir -p "$replica_dir$deletion_dir"
|
||||
if [ $? != 0 ]; then
|
||||
Logger "Cannot create replica deletion directory." "ERROR"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $_VERBOSE -eq 1 ]; then
|
||||
Logger "Soft deleting $replica_dir$files" "NOTICE"
|
||||
fi
|
||||
|
||||
if [ $_DRYRUN -ne 1 ]; then
|
||||
if [ ! -d "$replica_dir$deletion_dir" ]; then
|
||||
mkdir -p "$replica_dir$deletion_dir"
|
||||
if [ $? != 0 ]; then
|
||||
Logger "Cannot create replica deletion directory." "ERROR"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -e "$replica_dir$deletion_dir/$files" ]; then
|
||||
rm -rf "${replica_dir:?}$deletion_dir/$files"
|
||||
fi
|
||||
|
@ -2006,7 +2007,7 @@ function _delete_remote {
|
|||
|
||||
# Additionnaly, we need to copy the deletetion list to the remote state folder
|
||||
esc_dest_dir="$(EscapeSpaces "${TARGET[1]}${TARGET[3]}")"
|
||||
rsync_cmd="$(type -p $RSYNC_EXECUTABLE) --rsync-path=\"$RSYNC_PATH\" $SYNC_OPTS -e \"$RSYNC_SSH_CMD\" \"${INITIATOR[1]}${INITIATOR[3]}/$deleted_list_file\" $REMOTE_USER@$REMOTE_HOST:\"$esc_dest_dir/\" > $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.precopy.$SCRIPT_PID 2>&1"
|
||||
rsync_cmd="$(type -p $RSYNC_EXECUTABLE) --rsync-path=\"$RSYNC_PATH\" -e \"$RSYNC_SSH_CMD\" \"${INITIATOR[1]}${INITIATOR[3]}/$deleted_list_file\" $REMOTE_USER@$REMOTE_HOST:\"$esc_dest_dir/\" > $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.precopy.$SCRIPT_PID 2>&1"
|
||||
Logger "RSYNC_CMD: $rsync_cmd" "DEBUG"
|
||||
eval "$rsync_cmd" 2>> "$LOG_FILE"
|
||||
if [ $? != 0 ]; then
|
||||
|
@ -2068,12 +2069,6 @@ $SSH_CMD ERROR_ALERT=0 sync_on_changes=$sync_on_changes _SILENT=$_SILENT _DEBUG=
|
|||
do
|
||||
Logger "Processing file [$file]." "DEBUG"
|
||||
if [[ "$files" != "$previous_file/"* ]] && [ "$files" != "" ]; then
|
||||
if [ ! -d "$REPLICA_DIR$DELETE_DIR" ]; then
|
||||
$COMMAND_SUDO mkdir -p "$REPLICA_DIR$DELETE_DIR"
|
||||
if [ $? != 0 ]; then
|
||||
Logger "Cannot create replica deletion directory." "ERROR"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$SOFT_DELETE" != "no" ]; then
|
||||
if [ $_VERBOSE -eq 1 ]; then
|
||||
|
@ -2081,6 +2076,14 @@ $SSH_CMD ERROR_ALERT=0 sync_on_changes=$sync_on_changes _SILENT=$_SILENT _DEBUG=
|
|||
fi
|
||||
|
||||
Logger "Full path for deletion is [$REPLICA_DIR$DELETE_DIR/$files]." "DEBUG"
|
||||
|
||||
if [ ! -d "$REPLICA_DIR$DELETE_DIR" ]; then
|
||||
$COMMAND_SUDO mkdir -p "$REPLICA_DIR$DELETE_DIR"
|
||||
if [ $? != 0 ]; then
|
||||
Logger "Cannot create replica deletion directory." "ERROR"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $_DRYRUN -ne 1 ]; then
|
||||
if [ -e "$REPLICA_DIR$DELETE_DIR/$files" ]; then
|
||||
$COMMAND_SUDO rm -rf "$REPLICA_DIR$DELETE_DIR/$files"
|
||||
|
@ -2093,7 +2096,7 @@ $SSH_CMD ERROR_ALERT=0 sync_on_changes=$sync_on_changes _SILENT=$_SILENT _DEBUG=
|
|||
$COMMAND_SUDO mkdir -p "$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"1
|
||||
$COMMAND_SUDO mv -f "$REPLICA_DIR$files" "$REPLICA_DIR$DELETE_DIR"
|
||||
fi
|
||||
if [ $? != 0 ]; then
|
||||
Logger "Cannot move $REPLICA_DIR$files to deletion directory." "ERROR"
|
||||
|
@ -2127,7 +2130,7 @@ ENDSSH
|
|||
|
||||
## Copy back the deleted failed file list
|
||||
esc_source_file="$(EscapeSpaces "${TARGET[1]}${TARGET[3]}/$deleted_failed_list_file")"
|
||||
rsync_cmd="$(type -p $RSYNC_EXECUTABLE) --rsync-path=\"$RSYNC_PATH\" $SYNC_OPTS -e \"$RSYNC_SSH_CMD\" $REMOTE_USER@$REMOTE_HOST:\"$esc_source_file\" \"${INITIATOR[1]}${INITIATOR[3]}\" > \"$RUN_DIR/$PROGRAM.remote_failed_deletion_list_copy.$SCRIPT_PID\""
|
||||
rsync_cmd="$(type -p $RSYNC_EXECUTABLE) --rsync-path=\"$RSYNC_PATH\" -e \"$RSYNC_SSH_CMD\" $REMOTE_USER@$REMOTE_HOST:\"$esc_source_file\" \"${INITIATOR[1]}${INITIATOR[3]}\" > \"$RUN_DIR/$PROGRAM.remote_failed_deletion_list_copy.$SCRIPT_PID\""
|
||||
Logger "RSYNC_CMD: $rsync_cmd" "DEBUG"
|
||||
eval "$rsync_cmd" 2>> "$LOG_FILE"
|
||||
if [ $? != 0 ]; then
|
||||
|
|
Loading…
Reference in New Issue