diff --git a/dev/ofunctions.sh b/dev/ofunctions.sh index fe07c6b..e50785a 100644 --- a/dev/ofunctions.sh +++ b/dev/ofunctions.sh @@ -31,7 +31,7 @@ #### OFUNCTIONS MINI SUBSET #### #### OFUNCTIONS MICRO SUBSET #### _OFUNCTIONS_VERSION=2.3.0-RC4 -_OFUNCTIONS_BUILD=2020031503 +_OFUNCTIONS_BUILD=2020050301 #### _OFUNCTIONS_BOOTSTRAP SUBSET #### _OFUNCTIONS_BOOTSTRAP=true #### _OFUNCTIONS_BOOTSTRAP SUBSET END #### @@ -283,8 +283,8 @@ function Logger { fi ## Obfuscate _REMOTE_TOKEN in logs (for ssh_filter usage only in osync and obackup) - value="${value/env _REMOTE_TOKEN=$_REMOTE_TOKEN/env _REMOTE_TOKEN=__(o_O)__}" - value="${value/env _REMOTE_TOKEN=\$_REMOTE_TOKEN/env _REMOTE_TOKEN=__(o_O)__}" + value="${value/env _REMOTE_TOKEN=$_REMOTE_TOKEN/env _REMOTE_TOKEN=__o_O__}" + value="${value/env _REMOTE_TOKEN=\$_REMOTE_TOKEN/env _REMOTE_TOKEN=__o_O__}" if [ "$level" == "CRITICAL" ]; then _Logger "$prefix($level):$value" "$prefix\e[1;33;41m$value\e[0m" true @@ -439,7 +439,7 @@ function GenericTrapQuit { exit $exitcode } -#### GenericTrapQuit SUBSET END #### +#### TrapQuit SUBSET END #### #### CleanUp SUBSET #### function CleanUp { @@ -1780,11 +1780,7 @@ function RunLocalCommand { if [ $_LOGGER_VERBOSE == true ] || [ $retval -ne 0 ]; then Logger "Truncated output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP")" "NOTICE" fi - - if [ "$STOP_ON_CMD_ERROR" == true ] && [ $retval -ne 0 ]; then - Logger "Stopping on command execution error." "CRITICAL" - exit 1 - fi + return $retval } ## Runs remote command $1 and waits for completition in $2 seconds @@ -1818,15 +1814,10 @@ function RunRemoteCommand { Logger "Command failed." "ERROR" fi - if [ -f "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" ] && ([ $_LOGGER_VERBOSE == true ] || [ $retval -ne 0 ]) - then + if [ -f "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" ] && ([ $_LOGGER_VERBOSE == true ] || [ $retval -ne 0 ]); then Logger "Truncated output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP")" "NOTICE" fi - - if [ "$STOP_ON_CMD_ERROR" == true ] && [ $retval -ne 0 ]; then - Logger "Stopping on command execution error." "CRITICAL" - exit 1 - fi + return $retval } function RunBeforeHook { @@ -1845,6 +1836,14 @@ function RunBeforeHook { fi if [ "$pids" != "" ]; then ExecTasks $pids "${FUNCNAME[0]}" false 0 0 0 0 true $SLEEP_TIME $KEEP_LOGGING + retval=$? + fi + + echo "ert=$retval" + + if [ "$STOP_ON_CMD_ERROR" == true ] && [ $retval -ne 0 ]; then + Logger "Stopping on command execution error." "CRITICAL" + exit 1 fi } @@ -2052,7 +2051,7 @@ function PreInit { fi ## Set compression executable and extension - if [ "$(IsInteger $COMPRESSION_LEVEL)" -eq 0 ]; then + if [ "$(IsInteger "$COMPRESSION_LEVEL")" -eq 0 ]; then COMPRESSION_LEVEL=3 fi }