1
0
mirror of https://github.com/deajan/obackup.git synced 2024-11-15 04:03:41 +01:00

Update ofunctions from osync project

This commit is contained in:
deajan 2020-05-03 09:05:20 +01:00
parent d36386ee61
commit 7c51784aa1

View File

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