From 2b17326630e3ab9dc8f65b4f5455e55383edd1cb Mon Sep 17 00:00:00 2001 From: deajan Date: Wed, 22 May 2019 22:57:04 +0200 Subject: [PATCH] Rebuilt targets --- dev/debug_osync.sh | 38 ++++++++++++++++++-------------------- install.sh | 11 +++++------ osync-batch.sh | 2 +- osync.sh | 38 ++++++++++++++++++-------------------- 4 files changed, 42 insertions(+), 47 deletions(-) diff --git a/dev/debug_osync.sh b/dev/debug_osync.sh index 27774fc..99e01f7 100755 --- a/dev/debug_osync.sh +++ b/dev/debug_osync.sh @@ -7,7 +7,7 @@ PROGRAM="osync" # Rsync based two way sync engine with fault tolerance AUTHOR="(C) 2013-2019 by Orsiris de Jong" CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr" PROGRAM_VERSION=1.3.0-beta3+dev -PROGRAM_BUILD=2019052202 +PROGRAM_BUILD=2019052203 IS_STABLE=false CONFIG_FILE_REVISION_REQUIRED=1.3.0 @@ -43,7 +43,7 @@ CONFIG_FILE_REVISION_REQUIRED=1.3.0 # CleanUp no #__WITH_PARANOIA_DEBUG _OFUNCTIONS_VERSION=2.3.0-dev-postRC2 -_OFUNCTIONS_BUILD=2019052201 +_OFUNCTIONS_BUILD=2019052203 _OFUNCTIONS_BOOTSTRAP=true if ! type "$BASH" > /dev/null; then @@ -195,7 +195,7 @@ function _Logger { # Build current log file for alerts if we have a sufficient environment if [ "$RUN_DIR/$PROGRAM" != "/" ]; then - echo -e "$logValue" >> "$RUN_DIR/$PROGRAM._Logger.$SCRIPT_PID.$TSTAMP.log" + echo -e "$logValue" >> "$RUN_DIR/$PROGRAM._Logger.$SCRIPT_PID.$TSTAMP" fi fi @@ -496,7 +496,7 @@ function SendAlert { fi fi - body="$MAIL_ALERT_MSG"$'\n\n'"Last 1000 lines of current log"$'\n\n'"$(tail -n 1000 "$RUN_DIR/$PROGRAM._Logger.$SCRIPT_PID.$TSTAMP.log")" + body="$MAIL_ALERT_MSG"$'\n\n'"Last 1000 lines of current log"$'\n\n'"$(tail -n 1000 "$RUN_DIR/$PROGRAM._Logger.$SCRIPT_PID.$TSTAMP")" if [ $ERROR_ALERT == true ]; then subject="Error alert for $INSTANCE_ID" @@ -574,7 +574,7 @@ function SendEmail { if [ "$MAIL_BODY_CHARSET" != "" ]; then if type iconv > /dev/null 2>&1; then echo "$message" | iconv -f UTF-8 -t $MAIL_BODY_CHARSET -o "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.iconv.$SCRIPT_PID.$TSTAMP" - message="$(cat $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.iconv.$SCRIPT_PID.$TSTAMP)" + message="$(cat "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.iconv.$SCRIPT_PID.$TSTAMP")" else Logger "iconv utility not installed. Will not convert email charset." "NOTICE" fi @@ -1107,7 +1107,7 @@ function ExecTasks { Logger "Command was [${commandsArrayPid[$pid]}]." "ERROR" fi if [ -f "${commandsArrayOutput[$pid]}" ]; then - Logger "Command output was [$(cat ${commandsArrayOutput[$pid]})\n]." "ERROR" + Logger "Command output was [$(cat "${commandsArrayOutput[$pid]}")\n]." "ERROR" fi fi errorcount=$((errorcount+1)) @@ -1209,7 +1209,7 @@ function ExecTasks { postponedRetryCount=0 postponedExecTime=0 fi - if ([ $postponedRetryCount -lt $maxPostponeRetries ] && [ $postponedExecTime -ge $((minTimeBetweenRetries)) ]) || [ $isPostponedCommand == false ]; then + if ([ $postponedRetryCount -lt $maxPostponeRetries ] && [ $postponedExecTime -ge $minTimeBetweenRetries ]) || [ $isPostponedCommand == false ]; then if [ "$currentCommandCondition" != "" ]; then Logger "Checking condition [$currentCommandCondition] for command [$currentCommand]." "DEBUG" eval "$currentCommandCondition" & @@ -1759,7 +1759,7 @@ function RunLocalCommand { fi if [ $_LOGGER_VERBOSE == true ] || [ $retval -ne 0 ]; then - 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 if [ "$STOP_ON_CMD_ERROR" == true ] && [ $retval -ne 0 ]; then @@ -1802,7 +1802,7 @@ function RunRemoteCommand { if [ -f "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" ] && ([ $_LOGGER_VERBOSE == true ] || [ $retval -ne 0 ]) then - 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 if [ "$STOP_ON_CMD_ERROR" == true ] && [ $retval -ne 0 ]; then @@ -1941,8 +1941,8 @@ function RsyncPatternsFromAdd { __CheckArguments 2 $# "$@" #__WITH_PARANOIA_DEBUG ## Check if the exclude list has a full path, and if not, add the config file path if there is one - if [ "$(basename $patternFrom)" == "$patternFrom" ]; then - patternFrom="$(dirname $CONFIG_FILE)/$patternFrom" + if [ "$(basename "$patternFrom")" == "$patternFrom" ]; then + patternFrom="$(dirname "$CONFIG_FILE")/$patternFrom" fi if [ -e "$patternFrom" ]; then @@ -2165,7 +2165,7 @@ function InitRemoteOSDependingSettings { __CheckArguments 0 $# "$@" #__WITH_PARANOIA_DEBUG if [ "$REMOTE_OS" == "msys" ] || [ "$REMOTE_OS" == "Cygwin" ]; then - REMOTE_FIND_CMD=$(dirname $BASH)/find + REMOTE_FIND_CMD="$(dirname $BASH)/find" else REMOTE_FIND_CMD=find fi @@ -2779,7 +2779,7 @@ function _Logger { # Build current log file for alerts if we have a sufficient environment if [ "$RUN_DIR/$PROGRAM" != "/" ]; then - echo -e "$logValue" >> "$RUN_DIR/$PROGRAM._Logger.$SCRIPT_PID.$TSTAMP.log" + echo -e "$logValue" >> "$RUN_DIR/$PROGRAM._Logger.$SCRIPT_PID.$TSTAMP" fi fi @@ -3145,7 +3145,7 @@ function _Logger { # Build current log file for alerts if we have a sufficient environment if [ "$RUN_DIR/$PROGRAM" != "/" ]; then - echo -e "$logValue" >> "$RUN_DIR/$PROGRAM._Logger.$SCRIPT_PID.$TSTAMP.log" + echo -e "$logValue" >> "$RUN_DIR/$PROGRAM._Logger.$SCRIPT_PID.$TSTAMP" fi fi @@ -3756,7 +3756,7 @@ function _Logger { # Build current log file for alerts if we have a sufficient environment if [ "$RUN_DIR/$PROGRAM" != "/" ]; then - echo -e "$logValue" >> "$RUN_DIR/$PROGRAM._Logger.$SCRIPT_PID.$TSTAMP.log" + echo -e "$logValue" >> "$RUN_DIR/$PROGRAM._Logger.$SCRIPT_PID.$TSTAMP" fi fi @@ -4406,7 +4406,7 @@ function _Logger { # Build current log file for alerts if we have a sufficient environment if [ "$RUN_DIR/$PROGRAM" != "/" ]; then - echo -e "$logValue" >> "$RUN_DIR/$PROGRAM._Logger.$SCRIPT_PID.$TSTAMP.log" + echo -e "$logValue" >> "$RUN_DIR/$PROGRAM._Logger.$SCRIPT_PID.$TSTAMP" fi fi @@ -4706,8 +4706,6 @@ function Initialize { ###### Step 8a & 8b: Create after run ctime & mtime file list of replicas function Sync { - local syncType="${1}" # Optional sync type. By default, sync is bidirectional. - __CheckArguments 0 $# "$@" #__WITH_PARANOIA_DEBUG local resumeCount @@ -5383,7 +5381,7 @@ function _Logger { # Build current log file for alerts if we have a sufficient environment if [ "$RUN_DIR/$PROGRAM" != "/" ]; then - echo -e "$logValue" >> "$RUN_DIR/$PROGRAM._Logger.$SCRIPT_PID.$TSTAMP.log" + echo -e "$logValue" >> "$RUN_DIR/$PROGRAM._Logger.$SCRIPT_PID.$TSTAMP" fi fi @@ -5657,7 +5655,7 @@ function _Logger { # Build current log file for alerts if we have a sufficient environment if [ "$RUN_DIR/$PROGRAM" != "/" ]; then - echo -e "$logValue" >> "$RUN_DIR/$PROGRAM._Logger.$SCRIPT_PID.$TSTAMP.log" + echo -e "$logValue" >> "$RUN_DIR/$PROGRAM._Logger.$SCRIPT_PID.$TSTAMP" fi fi diff --git a/install.sh b/install.sh index 059c3ef..d4b22fb 100755 --- a/install.sh +++ b/install.sh @@ -10,7 +10,7 @@ PROGRAM_BINARY=$PROGRAM".sh" PROGRAM_BATCH=$PROGRAM"-batch.sh" SSH_FILTER="ssh_filter.sh" -SCRIPT_BUILD=2019052001 +SCRIPT_BUILD=2019052202 INSTANCE_ID="installer-$SCRIPT_BUILD" ## osync / obackup / pmocr / zsnap install script @@ -18,7 +18,7 @@ INSTANCE_ID="installer-$SCRIPT_BUILD" ## Please adapt this to fit your distro needs _OFUNCTIONS_VERSION=2.3.0-dev-postRC2 -_OFUNCTIONS_BUILD=2019052201 +_OFUNCTIONS_BUILD=2019052203 _OFUNCTIONS_BOOTSTRAP=true if ! type "$BASH" > /dev/null; then @@ -166,7 +166,7 @@ function _Logger { # Build current log file for alerts if we have a sufficient environment if [ "$RUN_DIR/$PROGRAM" != "/" ]; then - echo -e "$logValue" >> "$RUN_DIR/$PROGRAM._Logger.$SCRIPT_PID.$TSTAMP.log" + echo -e "$logValue" >> "$RUN_DIR/$PROGRAM._Logger.$SCRIPT_PID.$TSTAMP" fi fi @@ -741,15 +741,14 @@ function CopyFile { local overwrite="${8:-false}" local userGroup="" - local oldFileName if [ "$destFileName" == "" ]; then destFileName="$sourceFileName" fi if [ -f "$destPath/$destFileName" ] && [ $overwrite == false ]; then - destfileName="$sourceFileName.new" - Logger "Copying [$sourceFileName] to [$destPath/$destFilename]." "NOTICE" + destFileName="$sourceFileName.new" + Logger "Copying [$sourceFileName] to [$destPath/$destFileName]." "NOTICE" fi cp "$sourcePath/$sourceFileName" "$destPath/$destFileName" diff --git a/osync-batch.sh b/osync-batch.sh index 190ed1d..7ecf756 100755 --- a/osync-batch.sh +++ b/osync-batch.sh @@ -58,7 +58,7 @@ function _Logger { # Build current log file for alerts if we have a sufficient environment if [ "$RUN_DIR/$PROGRAM" != "/" ]; then - echo -e "$logValue" >> "$RUN_DIR/$PROGRAM._Logger.$SCRIPT_PID.$TSTAMP.log" + echo -e "$logValue" >> "$RUN_DIR/$PROGRAM._Logger.$SCRIPT_PID.$TSTAMP" fi fi diff --git a/osync.sh b/osync.sh index bcdec6a..a1eb606 100755 --- a/osync.sh +++ b/osync.sh @@ -7,14 +7,14 @@ PROGRAM="osync" # Rsync based two way sync engine with fault tolerance AUTHOR="(C) 2013-2019 by Orsiris de Jong" CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr" PROGRAM_VERSION=1.3.0-beta3+dev -PROGRAM_BUILD=2019052202 +PROGRAM_BUILD=2019052203 IS_STABLE=false CONFIG_FILE_REVISION_REQUIRED=1.3.0 _OFUNCTIONS_VERSION=2.3.0-dev-postRC2 -_OFUNCTIONS_BUILD=2019052201 +_OFUNCTIONS_BUILD=2019052203 _OFUNCTIONS_BOOTSTRAP=true if ! type "$BASH" > /dev/null; then @@ -162,7 +162,7 @@ function _Logger { # Build current log file for alerts if we have a sufficient environment if [ "$RUN_DIR/$PROGRAM" != "/" ]; then - echo -e "$logValue" >> "$RUN_DIR/$PROGRAM._Logger.$SCRIPT_PID.$TSTAMP.log" + echo -e "$logValue" >> "$RUN_DIR/$PROGRAM._Logger.$SCRIPT_PID.$TSTAMP" fi fi @@ -450,7 +450,7 @@ function SendAlert { fi fi - body="$MAIL_ALERT_MSG"$'\n\n'"Last 1000 lines of current log"$'\n\n'"$(tail -n 1000 "$RUN_DIR/$PROGRAM._Logger.$SCRIPT_PID.$TSTAMP.log")" + body="$MAIL_ALERT_MSG"$'\n\n'"Last 1000 lines of current log"$'\n\n'"$(tail -n 1000 "$RUN_DIR/$PROGRAM._Logger.$SCRIPT_PID.$TSTAMP")" if [ $ERROR_ALERT == true ]; then subject="Error alert for $INSTANCE_ID" @@ -527,7 +527,7 @@ function SendEmail { if [ "$MAIL_BODY_CHARSET" != "" ]; then if type iconv > /dev/null 2>&1; then echo "$message" | iconv -f UTF-8 -t $MAIL_BODY_CHARSET -o "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.iconv.$SCRIPT_PID.$TSTAMP" - message="$(cat $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.iconv.$SCRIPT_PID.$TSTAMP)" + message="$(cat "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.iconv.$SCRIPT_PID.$TSTAMP")" else Logger "iconv utility not installed. Will not convert email charset." "NOTICE" fi @@ -1039,7 +1039,7 @@ function ExecTasks { Logger "Command was [${commandsArrayPid[$pid]}]." "ERROR" fi if [ -f "${commandsArrayOutput[$pid]}" ]; then - Logger "Command output was [$(cat ${commandsArrayOutput[$pid]})\n]." "ERROR" + Logger "Command output was [$(cat "${commandsArrayOutput[$pid]}")\n]." "ERROR" fi fi errorcount=$((errorcount+1)) @@ -1134,7 +1134,7 @@ function ExecTasks { postponedRetryCount=0 postponedExecTime=0 fi - if ([ $postponedRetryCount -lt $maxPostponeRetries ] && [ $postponedExecTime -ge $((minTimeBetweenRetries)) ]) || [ $isPostponedCommand == false ]; then + if ([ $postponedRetryCount -lt $maxPostponeRetries ] && [ $postponedExecTime -ge $minTimeBetweenRetries ]) || [ $isPostponedCommand == false ]; then if [ "$currentCommandCondition" != "" ]; then Logger "Checking condition [$currentCommandCondition] for command [$currentCommand]." "DEBUG" eval "$currentCommandCondition" & @@ -1626,7 +1626,7 @@ function RunLocalCommand { fi if [ $_LOGGER_VERBOSE == true ] || [ $retval -ne 0 ]; then - 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 if [ "$STOP_ON_CMD_ERROR" == true ] && [ $retval -ne 0 ]; then @@ -1668,7 +1668,7 @@ function RunRemoteCommand { if [ -f "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" ] && ([ $_LOGGER_VERBOSE == true ] || [ $retval -ne 0 ]) then - 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 if [ "$STOP_ON_CMD_ERROR" == true ] && [ $retval -ne 0 ]; then @@ -1797,8 +1797,8 @@ function RsyncPatternsFromAdd { local patternFrom="${2}" ## Check if the exclude list has a full path, and if not, add the config file path if there is one - if [ "$(basename $patternFrom)" == "$patternFrom" ]; then - patternFrom="$(dirname $CONFIG_FILE)/$patternFrom" + if [ "$(basename "$patternFrom")" == "$patternFrom" ]; then + patternFrom="$(dirname "$CONFIG_FILE")/$patternFrom" fi if [ -e "$patternFrom" ]; then @@ -2016,7 +2016,7 @@ function InitLocalOSDependingSettings { function InitRemoteOSDependingSettings { if [ "$REMOTE_OS" == "msys" ] || [ "$REMOTE_OS" == "Cygwin" ]; then - REMOTE_FIND_CMD=$(dirname $BASH)/find + REMOTE_FIND_CMD="$(dirname $BASH)/find" else REMOTE_FIND_CMD=find fi @@ -2621,7 +2621,7 @@ function _Logger { # Build current log file for alerts if we have a sufficient environment if [ "$RUN_DIR/$PROGRAM" != "/" ]; then - echo -e "$logValue" >> "$RUN_DIR/$PROGRAM._Logger.$SCRIPT_PID.$TSTAMP.log" + echo -e "$logValue" >> "$RUN_DIR/$PROGRAM._Logger.$SCRIPT_PID.$TSTAMP" fi fi @@ -2975,7 +2975,7 @@ function _Logger { # Build current log file for alerts if we have a sufficient environment if [ "$RUN_DIR/$PROGRAM" != "/" ]; then - echo -e "$logValue" >> "$RUN_DIR/$PROGRAM._Logger.$SCRIPT_PID.$TSTAMP.log" + echo -e "$logValue" >> "$RUN_DIR/$PROGRAM._Logger.$SCRIPT_PID.$TSTAMP" fi fi @@ -3569,7 +3569,7 @@ function _Logger { # Build current log file for alerts if we have a sufficient environment if [ "$RUN_DIR/$PROGRAM" != "/" ]; then - echo -e "$logValue" >> "$RUN_DIR/$PROGRAM._Logger.$SCRIPT_PID.$TSTAMP.log" + echo -e "$logValue" >> "$RUN_DIR/$PROGRAM._Logger.$SCRIPT_PID.$TSTAMP" fi fi @@ -4204,7 +4204,7 @@ function _Logger { # Build current log file for alerts if we have a sufficient environment if [ "$RUN_DIR/$PROGRAM" != "/" ]; then - echo -e "$logValue" >> "$RUN_DIR/$PROGRAM._Logger.$SCRIPT_PID.$TSTAMP.log" + echo -e "$logValue" >> "$RUN_DIR/$PROGRAM._Logger.$SCRIPT_PID.$TSTAMP" fi fi @@ -4497,8 +4497,6 @@ function Initialize { ###### Step 8a & 8b: Create after run ctime & mtime file list of replicas function Sync { - local syncType="${1}" # Optional sync type. By default, sync is bidirectional. - local resumeCount local resumeInitiator @@ -5167,7 +5165,7 @@ function _Logger { # Build current log file for alerts if we have a sufficient environment if [ "$RUN_DIR/$PROGRAM" != "/" ]; then - echo -e "$logValue" >> "$RUN_DIR/$PROGRAM._Logger.$SCRIPT_PID.$TSTAMP.log" + echo -e "$logValue" >> "$RUN_DIR/$PROGRAM._Logger.$SCRIPT_PID.$TSTAMP" fi fi @@ -5429,7 +5427,7 @@ function _Logger { # Build current log file for alerts if we have a sufficient environment if [ "$RUN_DIR/$PROGRAM" != "/" ]; then - echo -e "$logValue" >> "$RUN_DIR/$PROGRAM._Logger.$SCRIPT_PID.$TSTAMP.log" + echo -e "$logValue" >> "$RUN_DIR/$PROGRAM._Logger.$SCRIPT_PID.$TSTAMP" fi fi