mirror of
https://github.com/deajan/obackup.git
synced 2024-12-04 12:43:42 +01:00
Rebuilt targets
This commit is contained in:
parent
20946f6f24
commit
b5a951fcce
@ -7,7 +7,7 @@ PROGRAM="obackup"
|
|||||||
AUTHOR="(C) 2013-2019 by Orsiris de Jong"
|
AUTHOR="(C) 2013-2019 by Orsiris de Jong"
|
||||||
CONTACT="http://www.netpower.fr/obackup - ozy@netpower.fr"
|
CONTACT="http://www.netpower.fr/obackup - ozy@netpower.fr"
|
||||||
PROGRAM_VERSION=2.1-dev-postRC1
|
PROGRAM_VERSION=2.1-dev-postRC1
|
||||||
PROGRAM_BUILD=2020031501
|
PROGRAM_BUILD=2020050302
|
||||||
IS_STABLE=true
|
IS_STABLE=true
|
||||||
|
|
||||||
CONFIG_FILE_REVISION_REQUIRED=2.1
|
CONFIG_FILE_REVISION_REQUIRED=2.1
|
||||||
@ -37,7 +37,7 @@ CONFIG_FILE_REVISION_REQUIRED=2.1
|
|||||||
# FilesBackup #__WITH_PARANOIA_DEBUG
|
# FilesBackup #__WITH_PARANOIA_DEBUG
|
||||||
|
|
||||||
_OFUNCTIONS_VERSION=2.3.0-RC4
|
_OFUNCTIONS_VERSION=2.3.0-RC4
|
||||||
_OFUNCTIONS_BUILD=2020031503
|
_OFUNCTIONS_BUILD=2020050301
|
||||||
_OFUNCTIONS_BOOTSTRAP=true
|
_OFUNCTIONS_BOOTSTRAP=true
|
||||||
|
|
||||||
if ! type "$BASH" > /dev/null; then
|
if ! type "$BASH" > /dev/null; then
|
||||||
@ -278,8 +278,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
|
||||||
@ -430,6 +430,7 @@ function GenericTrapQuit {
|
|||||||
exit $exitcode
|
exit $exitcode
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#### TrapQuit SUBSET END ####
|
||||||
|
|
||||||
function CleanUp {
|
function CleanUp {
|
||||||
# Exit controlmaster before it's socket gets deleted
|
# Exit controlmaster before it's socket gets deleted
|
||||||
@ -1754,11 +1755,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
|
||||||
@ -1792,15 +1789,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 {
|
||||||
@ -1819,6 +1811,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
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2026,7 +2026,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
|
||||||
}
|
}
|
||||||
@ -2663,7 +2663,7 @@ function _ListDatabasesLocal {
|
|||||||
Logger "Listing databases failed." "ERROR"
|
Logger "Listing databases failed." "ERROR"
|
||||||
_LOGGER_SILENT=true Logger "Command was [$sqlCmd]." "WARN"
|
_LOGGER_SILENT=true Logger "Command was [$sqlCmd]." "WARN"
|
||||||
if [ -f "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" ]; then
|
if [ -f "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" ]; then
|
||||||
Logger "Truncated output:\n$(head -c16384 $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP)" "ERROR"
|
Logger "Truncated output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP")" "ERROR"
|
||||||
fi
|
fi
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@ -2689,7 +2689,7 @@ function _ListDatabasesRemote {
|
|||||||
Logger "Listing databases failed." "ERROR"
|
Logger "Listing databases failed." "ERROR"
|
||||||
Logger "Command output: $sqlCmd" "WARN"
|
Logger "Command output: $sqlCmd" "WARN"
|
||||||
if [ -f "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" ]; then
|
if [ -f "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" ]; then
|
||||||
Logger "Truncated output:\n$(head -c16384 $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP)" "ERROR"
|
Logger "Truncated output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP")" "ERROR"
|
||||||
fi
|
fi
|
||||||
return $retval
|
return $retval
|
||||||
fi
|
fi
|
||||||
@ -2806,11 +2806,11 @@ function _ListRecursiveBackupDirectoriesLocal {
|
|||||||
if [ $retval -ne 0 ]; then
|
if [ $retval -ne 0 ]; then
|
||||||
Logger "Could not enumerate directories in [$directory]." "ERROR"
|
Logger "Could not enumerate directories in [$directory]." "ERROR"
|
||||||
_LOGGER_SILENT=true Logger "Command was [$cmd]." "WARN"
|
_LOGGER_SILENT=true Logger "Command was [$cmd]." "WARN"
|
||||||
if [ -f $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP ]; then
|
if [ -f "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" ]; then
|
||||||
Logger "Truncated output:\n$(head -c16384 $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP)" "ERROR"
|
Logger "Truncated output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP")" "ERROR"
|
||||||
fi
|
fi
|
||||||
if [ -f $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP ]; then
|
if [ -f "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP" ]; then
|
||||||
Logger "Truncated error output:\n$(head -c16384 $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP)" "ERROR"
|
Logger "Truncated error output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP")" "ERROR"
|
||||||
fi
|
fi
|
||||||
failuresPresent=true
|
failuresPresent=true
|
||||||
else
|
else
|
||||||
@ -2996,11 +2996,11 @@ exit $?
|
|||||||
ENDSSH
|
ENDSSH
|
||||||
retval=$?
|
retval=$?
|
||||||
if [ $retval -ne 0 ]; then
|
if [ $retval -ne 0 ]; then
|
||||||
if [ -f $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP ]; then
|
if [ -f "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" ]; then
|
||||||
Logger "Truncated output:\n$(head -c16384 $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP)" "ERROR"
|
Logger "Truncated output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP")" "ERROR"
|
||||||
fi
|
fi
|
||||||
if [ -f $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP ]; then
|
if [ -f "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP" ]; then
|
||||||
Logger "Truncated error output:\n$(head -c16384 $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP)" "ERROR"
|
Logger "Truncated error output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP")" "ERROR"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
return $retval
|
return $retval
|
||||||
@ -3100,19 +3100,19 @@ function _GetDirectoriesSizeLocal {
|
|||||||
Logger "Could not get files size for some or all local directories." "ERROR"
|
Logger "Could not get files size for some or all local directories." "ERROR"
|
||||||
_LOGGER_SILENT=true Logger "Command was [$cmd]." "WARN"
|
_LOGGER_SILENT=true Logger "Command was [$cmd]." "WARN"
|
||||||
if [ -f "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" ]; then
|
if [ -f "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" ]; then
|
||||||
Logger "Truncated output:\n$(head -c16384 $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP)" "ERROR"
|
Logger "Truncated output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP")" "ERROR"
|
||||||
fi
|
fi
|
||||||
if [ -f "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP" ]; then
|
if [ -f "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP" ]; then
|
||||||
Logger "Truncated error output:\n$(head -c16384 $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP)" "ERROR"
|
Logger "Truncated error output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP")" "ERROR"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
Logger "File size fetched successfully." "NOTICE"
|
Logger "File size fetched successfully." "NOTICE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -s "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" ]; then
|
if [ -s "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" ]; then
|
||||||
TOTAL_FILES_SIZE="$(head -c16384 $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP)"
|
TOTAL_FILES_SIZE="$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP")"
|
||||||
if [ $(IsInteger $TOTAL_FILES_SIZE) -eq 0 ]; then
|
if [ $(IsInteger "$TOTAL_FILES_SIZE") -eq 0 ]; then
|
||||||
TOTAL_FILES_SIZE="$(HumanToNumeric $TOTAL_FILES_SIZE)"
|
TOTAL_FILES_SIZE="$(HumanToNumeric "$TOTAL_FILES_SIZE")"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
TOTAL_FILES_SIZE=-1
|
TOTAL_FILES_SIZE=-1
|
||||||
@ -3269,18 +3269,18 @@ ENDSSH
|
|||||||
if [ $retval -ne 0 ] || [ -s "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP" ]; then
|
if [ $retval -ne 0 ] || [ -s "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP" ]; then
|
||||||
Logger "Could not get files size for some or all remote directories." "ERROR"
|
Logger "Could not get files size for some or all remote directories." "ERROR"
|
||||||
if [ -f "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" ]; then
|
if [ -f "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" ]; then
|
||||||
Logger "Truncated output:\n$(head -c16384 $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP)" "ERROR"
|
Logger "Truncated output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP")" "ERROR"
|
||||||
fi
|
fi
|
||||||
if [ -f "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP" ]; then
|
if [ -f "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP" ]; then
|
||||||
Logger "Truncated error output:\n$(head -c16384 $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP)" "ERROR"
|
Logger "Truncated error output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP")" "ERROR"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
Logger "File size fetched successfully." "NOTICE"
|
Logger "File size fetched successfully." "NOTICE"
|
||||||
fi
|
fi
|
||||||
if [ -s "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" ]; then
|
if [ -s "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" ]; then
|
||||||
TOTAL_FILES_SIZE="$(head -c16384 $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP)"
|
TOTAL_FILES_SIZE="$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP")"
|
||||||
if [ $(IsInteger $TOTAL_FILES_SIZE) -eq 0 ]; then
|
if [ $(IsInteger "$TOTAL_FILES_SIZE") -eq 0 ]; then
|
||||||
TOTAL_FILES_SIZE="$(HumanToNumeric $TOTAL_FILES_SIZE)"
|
TOTAL_FILES_SIZE="$(HumanToNumeric "$TOTAL_FILES_SIZE")"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
TOTAL_FILES_SIZE=-1
|
TOTAL_FILES_SIZE=-1
|
||||||
@ -3311,13 +3311,13 @@ function _CreateDirectoryLocal {
|
|||||||
|
|
||||||
if [ ! -d "$dirToCreate" ]; then
|
if [ ! -d "$dirToCreate" ]; then
|
||||||
# No sudo, you should have all necessary rights
|
# No sudo, you should have all necessary rights
|
||||||
mkdir -p "$dirToCreate" > $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP 2>&1 &
|
mkdir -p "$dirToCreate" > "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" 2>&1 &
|
||||||
ExecTasks $! "${FUNCNAME[0]}" false 0 0 720 1800 true $SLEEP_TIME $KEEP_LOGGING
|
ExecTasks $! "${FUNCNAME[0]}" false 0 0 720 1800 true $SLEEP_TIME $KEEP_LOGGING
|
||||||
retval=$?
|
retval=$?
|
||||||
if [ $retval -ne 0 ]; then
|
if [ $retval -ne 0 ]; then
|
||||||
Logger "Cannot create directory [$dirToCreate]" "CRITICAL"
|
Logger "Cannot create directory [$dirToCreate]" "CRITICAL"
|
||||||
if [ -f $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP ]; then
|
if [ -f "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" ]; then
|
||||||
Logger "Truncated output: $(head -c16384 $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP)" "ERROR"
|
Logger "Truncated output: $(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP")" "ERROR"
|
||||||
fi
|
fi
|
||||||
return $retval
|
return $retval
|
||||||
fi
|
fi
|
||||||
@ -3475,7 +3475,7 @@ ENDSSH
|
|||||||
ExecTasks $! "${FUNCNAME[0]}" false 0 0 720 1800 true $SLEEP_TIME $KEEP_LOGGING
|
ExecTasks $! "${FUNCNAME[0]}" false 0 0 720 1800 true $SLEEP_TIME $KEEP_LOGGING
|
||||||
retval=$?
|
retval=$?
|
||||||
if [ $retval -ne 0 ]; then
|
if [ $retval -ne 0 ]; then
|
||||||
Logger "Truncated output:\n$(head -c16384 $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP)" "ERROR"
|
Logger "Truncated output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP")" "ERROR"
|
||||||
return $retval
|
return $retval
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -3542,12 +3542,12 @@ function GetDiskSpaceLocal {
|
|||||||
if [ $retval -ne 0 ]; then
|
if [ $retval -ne 0 ]; then
|
||||||
DISK_SPACE=0
|
DISK_SPACE=0
|
||||||
Logger "Cannot get disk space in [$pathToCheck] on local system." "ERROR"
|
Logger "Cannot get disk space in [$pathToCheck] on local system." "ERROR"
|
||||||
Logger "Truncated output:\n$(head -c16384 $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP)" "ERROR"
|
Logger "Truncated output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP")" "ERROR"
|
||||||
else
|
else
|
||||||
DISK_SPACE=$(tail -1 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" | awk '{print $4}')
|
DISK_SPACE=$(tail -1 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" | awk '{print $4}')
|
||||||
DRIVE=$(tail -1 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" | awk '{print $1}')
|
DRIVE=$(tail -1 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" | awk '{print $1}')
|
||||||
if [ $(IsInteger $DISK_SPACE) -eq 0 ]; then
|
if [ $(IsInteger "$DISK_SPACE") -eq 0 ]; then
|
||||||
DISK_SPACE="$(HumanToNumeric $DISK_SPACE)"
|
DISK_SPACE="$(HumanToNumeric "$DISK_SPACE")"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
@ -3720,14 +3720,14 @@ ENDSSH
|
|||||||
if [ $retval -ne 0 ]; then
|
if [ $retval -ne 0 ]; then
|
||||||
DISK_SPACE=0
|
DISK_SPACE=0
|
||||||
Logger "Cannot get disk space in [$pathToCheck] on remote system." "ERROR"
|
Logger "Cannot get disk space in [$pathToCheck] on remote system." "ERROR"
|
||||||
Logger "Truncated output:\n$(head -c16384 $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP)" "ERROR"
|
Logger "Truncated output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP")" "ERROR"
|
||||||
Logger "Truncated output:\n$(head -c16384 $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP)" "ERROR"
|
Logger "Truncated output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP")" "ERROR"
|
||||||
return $retval
|
return $retval
|
||||||
else
|
else
|
||||||
DISK_SPACE=$(tail -1 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" | awk '{print $4}')
|
DISK_SPACE=$(tail -1 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" | awk '{print $4}')
|
||||||
DRIVE=$(tail -1 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" | awk '{print $1}')
|
DRIVE=$(tail -1 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" | awk '{print $1}')
|
||||||
if [ $(IsInteger $DISK_SPACE) -eq 0 ]; then
|
if [ $(IsInteger "$DISK_SPACE") -eq 0 ]; then
|
||||||
DISK_SPACE="$(HumanToNumeric $DISK_SPACE)"
|
DISK_SPACE="$(HumanToNumeric "$DISK_SPACE")"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -3903,7 +3903,7 @@ function _BackupDatabaseLocalToLocal {
|
|||||||
else
|
else
|
||||||
_LOGGER_SILENT=true Logger "Command was [$drySqlCmd]." "WARN"
|
_LOGGER_SILENT=true Logger "Command was [$drySqlCmd]." "WARN"
|
||||||
fi
|
fi
|
||||||
Logger "Truncated error output:\n$(head -c16384 $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP)" "ERROR"
|
Logger "Truncated error output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP")" "ERROR"
|
||||||
# Dirty fix for mysqldump return code not honored
|
# Dirty fix for mysqldump return code not honored
|
||||||
retval=1
|
retval=1
|
||||||
fi
|
fi
|
||||||
@ -3950,7 +3950,7 @@ function _BackupDatabaseLocalToRemote {
|
|||||||
else
|
else
|
||||||
_LOGGER_SILENT=true Logger "Command was [$drySqlCmd]." "WARN"
|
_LOGGER_SILENT=true Logger "Command was [$drySqlCmd]." "WARN"
|
||||||
fi
|
fi
|
||||||
Logger "Truncated error output:\n$(head -c16384 $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP)" "ERROR"
|
Logger "Truncated error output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP")" "ERROR"
|
||||||
# Dirty fix for mysqldump return code not honored
|
# Dirty fix for mysqldump return code not honored
|
||||||
retval=1
|
retval=1
|
||||||
fi
|
fi
|
||||||
@ -3997,7 +3997,7 @@ function _BackupDatabaseRemoteToLocal {
|
|||||||
else
|
else
|
||||||
_LOGGER_SILENT=true Logger "Command was [$drySqlCmd]." "WARN"
|
_LOGGER_SILENT=true Logger "Command was [$drySqlCmd]." "WARN"
|
||||||
fi
|
fi
|
||||||
Logger "Truncated error output:\n$(head -c16384 $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP)" "ERROR"
|
Logger "Truncated error output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP")" "ERROR"
|
||||||
# Dirty fix for mysqldump return code not honored
|
# Dirty fix for mysqldump return code not honored
|
||||||
retval=1
|
retval=1
|
||||||
fi
|
fi
|
||||||
@ -4103,13 +4103,13 @@ function EncryptFiles {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
Logger "Encrypting file [$sourceFile] to [$path/$file$cryptFileExtension]." "VERBOSE"
|
Logger "Encrypting file [$sourceFile] to [$path/$file$cryptFileExtension]." "VERBOSE"
|
||||||
if [ $(IsNumeric $PARALLEL_ENCRYPTION_PROCESSES) -eq 1 ] && [ "$PARALLEL_ENCRYPTION_PROCESSES" != "1" ]; then
|
if [ $(IsNumeric "$PARALLEL_ENCRYPTION_PROCESSES") -eq 1 ] && [ "$PARALLEL_ENCRYPTION_PROCESSES" != "1" ]; then
|
||||||
echo "$CRYPT_TOOL --batch --yes --out \"$path/$file$cryptFileExtension\" --recipient=\"$recipient\" --encrypt \"$sourceFile\" >> \"$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP\" 2>&1" >> "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.parallel.$SCRIPT_PID.$TSTAMP"
|
echo "$CRYPT_TOOL --batch --yes --out \"$path/$file$cryptFileExtension\" --recipient=\"$recipient\" --encrypt \"$sourceFile\" >> \"$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP\" 2>&1" >> "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.parallel.$SCRIPT_PID.$TSTAMP"
|
||||||
else
|
else
|
||||||
$CRYPT_TOOL --batch --yes --out "$path/$file$cryptFileExtension" --recipient="$recipient" --encrypt "$sourceFile" > "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" 2>&1
|
$CRYPT_TOOL --batch --yes --out "$path/$file$cryptFileExtension" --recipient="$recipient" --encrypt "$sourceFile" > "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" 2>&1
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
Logger "Cannot encrypt [$sourceFile]." "ERROR"
|
Logger "Cannot encrypt [$sourceFile]." "ERROR"
|
||||||
Logger "Truncated output:\n$(head -c16384 $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP)" "DEBUG"
|
Logger "Truncated output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP")" "DEBUG"
|
||||||
errorCounter=$((errorCounter+1))
|
errorCounter=$((errorCounter+1))
|
||||||
else
|
else
|
||||||
successCounter=$((successCounter+1))
|
successCounter=$((successCounter+1))
|
||||||
@ -4118,16 +4118,16 @@ function EncryptFiles {
|
|||||||
#TODO: This redirection does not work with busybox since there is no subshell support
|
#TODO: This redirection does not work with busybox since there is no subshell support
|
||||||
done < <($FIND_CMD "$filePath" $recursiveArgs -type f ! -name "*$cryptFileExtension" -print0)
|
done < <($FIND_CMD "$filePath" $recursiveArgs -type f ! -name "*$cryptFileExtension" -print0)
|
||||||
|
|
||||||
if [ $(IsNumeric $PARALLEL_ENCRYPTION_PROCESSES) -eq 1 ] && [ "$PARALLEL_ENCRYPTION_PROCESSES" != "1" ]; then
|
if [ $(IsNumeric "$PARALLEL_ENCRYPTION_PROCESSES") -eq 1 ] && [ "$PARALLEL_ENCRYPTION_PROCESSES" != "1" ]; then
|
||||||
# Handle batch mode where SOFT /HARD MAX EXEC TIME TOTAL is not defined
|
# Handle batch mode where SOFT /HARD MAX EXEC TIME TOTAL is not defined
|
||||||
if [ $(IsNumeric $SOFT_MAX_EXEC_TIME_TOTAL) -eq 1 ]; then
|
if [ $(IsNumeric "$SOFT_MAX_EXEC_TIME_TOTAL") -eq 1 ]; then
|
||||||
softMaxExecTime=$SOFT_MAX_EXEC_TIME_TOTAL
|
softMaxExecTime="$SOFT_MAX_EXEC_TIME_TOTAL"
|
||||||
else
|
else
|
||||||
softMaxExecTime=0
|
softMaxExecTime=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $(IsNumeric $HARD_MAX_EXEC_TIME_TOTAL) -eq 1 ]; then
|
if [ $(IsNumeric "$HARD_MAX_EXEC_TIME_TOTAL") -eq 1 ]; then
|
||||||
hardMaxExecTime=$HARD_MAX_EXEC_TIME_TOTAL
|
hardMaxExecTime="$HARD_MAX_EXEC_TIME_TOTAL"
|
||||||
else
|
else
|
||||||
hardMaxExecTime=0
|
hardMaxExecTime=0
|
||||||
fi
|
fi
|
||||||
@ -4136,7 +4136,7 @@ function EncryptFiles {
|
|||||||
if [ $retval -ne 0 ]; then
|
if [ $retval -ne 0 ]; then
|
||||||
Logger "Encryption error." "ERROR"
|
Logger "Encryption error." "ERROR"
|
||||||
# Output file is defined in ParallelExec
|
# Output file is defined in ParallelExec
|
||||||
Logger "Truncated output:\n$(head -c16384 $RUN_DIR/$PROGRAM.ExecTasks.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP)" "DEBUG"
|
Logger "Truncated output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.ExecTasks.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP")" "DEBUG"
|
||||||
fi
|
fi
|
||||||
successCounter=$(($(wc -l < "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.parallel.$SCRIPT_PID.$TSTAMP") - retval))
|
successCounter=$(($(wc -l < "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.parallel.$SCRIPT_PID.$TSTAMP") - retval))
|
||||||
errorCounter=$retval
|
errorCounter=$retval
|
||||||
@ -4177,7 +4177,7 @@ function DecryptFiles {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Detect if GnuPG >= 2.1 that does not allow automatic pin entry anymore
|
# Detect if GnuPG >= 2.1 that does not allow automatic pin entry anymore
|
||||||
cryptToolVersion=$($CRYPT_TOOL --version | head -1 | awk '{print $3}')
|
cryptToolVersion=$("$CRYPT_TOOL" --version | head -1 | awk '{print $3}')
|
||||||
cryptToolMajorVersion=${cryptToolVersion%%.*}
|
cryptToolMajorVersion=${cryptToolVersion%%.*}
|
||||||
cryptToolSubVersion=${cryptToolVersion#*.}
|
cryptToolSubVersion=${cryptToolVersion#*.}
|
||||||
cryptToolSubVersion=${cryptToolSubVersion%.*}
|
cryptToolSubVersion=${cryptToolSubVersion%.*}
|
||||||
@ -4204,14 +4204,14 @@ function DecryptFiles {
|
|||||||
while IFS= read -r -d $'\0' encryptedFile; do
|
while IFS= read -r -d $'\0' encryptedFile; do
|
||||||
Logger "Decrypting [$encryptedFile]." "VERBOSE"
|
Logger "Decrypting [$encryptedFile]." "VERBOSE"
|
||||||
|
|
||||||
if [ $(IsNumeric $PARALLEL_ENCRYPTION_PROCESSES) -eq 1 ] && [ "$PARALLEL_ENCRYPTION_PROCESSES" != "1" ]; then
|
if [ $(IsNumeric "$PARALLEL_ENCRYPTION_PROCESSES") -eq 1 ] && [ "$PARALLEL_ENCRYPTION_PROCESSES" != "1" ]; then
|
||||||
echo "$CRYPT_TOOL $options --out \"${encryptedFile%%$cryptFileExtension}\" $additionalParameters $secret --decrypt \"$encryptedFile\" >> \"$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP\" 2>&1" >> "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.parallel.$SCRIPT_PID.$TSTAMP"
|
echo "$CRYPT_TOOL $options --out \"${encryptedFile%%$cryptFileExtension}\" $additionalParameters $secret --decrypt \"$encryptedFile\" >> \"$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP\" 2>&1" >> "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.parallel.$SCRIPT_PID.$TSTAMP"
|
||||||
else
|
else
|
||||||
$CRYPT_TOOL $options --out "${encryptedFile%%$cryptFileExtension}" $additionalParameters $secret --decrypt "$encryptedFile" > "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" 2>&1
|
$CRYPT_TOOL $options --out "${encryptedFile%%$cryptFileExtension}" $additionalParameters $secret --decrypt "$encryptedFile" > "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" 2>&1
|
||||||
retval=$?
|
retval=$?
|
||||||
if [ $retval -ne 0 ]; then
|
if [ $retval -ne 0 ]; then
|
||||||
Logger "Cannot decrypt [$encryptedFile]." "ERROR"
|
Logger "Cannot decrypt [$encryptedFile]." "ERROR"
|
||||||
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"
|
||||||
errorCounter=$((errorCounter+1))
|
errorCounter=$((errorCounter+1))
|
||||||
else
|
else
|
||||||
successCounter=$((successCounter+1))
|
successCounter=$((successCounter+1))
|
||||||
@ -4223,15 +4223,15 @@ function DecryptFiles {
|
|||||||
fi
|
fi
|
||||||
done < <($FIND_CMD "$filePath" -type f -name "*$cryptFileExtension" -print0)
|
done < <($FIND_CMD "$filePath" -type f -name "*$cryptFileExtension" -print0)
|
||||||
|
|
||||||
if [ $(IsNumeric $PARALLEL_ENCRYPTION_PROCESSES) -eq 1 ] && [ "$PARALLEL_ENCRYPTION_PROCESSES" != "1" ]; then
|
if [ $(IsNumeric "$PARALLEL_ENCRYPTION_PROCESSES") -eq 1 ] && [ "$PARALLEL_ENCRYPTION_PROCESSES" != "1" ]; then
|
||||||
# Handle batch mode where SOFT /HARD MAX EXEC TIME TOTAL is not defined
|
# Handle batch mode where SOFT /HARD MAX EXEC TIME TOTAL is not defined
|
||||||
if [ $(IsNumeric $SOFT_MAX_EXEC_TIME_TOTAL) -eq 1 ]; then
|
if [ $(IsNumeric "$SOFT_MAX_EXEC_TIME_TOTAL") -eq 1 ]; then
|
||||||
softMaxExecTime=$SOFT_MAX_EXEC_TIME_TOTAL
|
softMaxExecTime=$SOFT_MAX_EXEC_TIME_TOTAL
|
||||||
else
|
else
|
||||||
softMaxExecTime=0
|
softMaxExecTime=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $(IsNumeric $HARD_MAX_EXEC_TIME_TOTAL) -eq 1 ]; then
|
if [ $(IsNumeric "$HARD_MAX_EXEC_TIME_TOTAL") -eq 1 ]; then
|
||||||
hardMaxExecTime=$HARD_MAX_EXEC_TIME_TOTAL
|
hardMaxExecTime=$HARD_MAX_EXEC_TIME_TOTAL
|
||||||
else
|
else
|
||||||
hardMaxExecTime=0
|
hardMaxExecTime=0
|
||||||
@ -4242,7 +4242,7 @@ function DecryptFiles {
|
|||||||
if [ $retval -ne 0 ]; then
|
if [ $retval -ne 0 ]; then
|
||||||
Logger "Decrypting error.." "ERROR"
|
Logger "Decrypting error.." "ERROR"
|
||||||
# Output file is defined in ParallelExec
|
# Output file is defined in ParallelExec
|
||||||
Logger "Truncated output:\n$(head -c16384 $RUN_DIR/$PROGRAM.ParallelExec.EncryptFiles.$SCRIPT_PID.$TSTAMP)" "DEBUG"
|
Logger "Truncated output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.ParallelExec.EncryptFiles.$SCRIPT_PID.$TSTAMP")" "DEBUG"
|
||||||
fi
|
fi
|
||||||
successCounter=$(($(wc -l < "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.parallel.$SCRIPT_PID.$TSTAMP") - retval))
|
successCounter=$(($(wc -l < "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.parallel.$SCRIPT_PID.$TSTAMP") - retval))
|
||||||
errorCounter=$retval
|
errorCounter=$retval
|
||||||
@ -4288,14 +4288,12 @@ function Rsync {
|
|||||||
_CreateDirectoryLocal "$destinationDir"
|
_CreateDirectoryLocal "$destinationDir"
|
||||||
CheckConnectivity3rdPartyHosts
|
CheckConnectivity3rdPartyHosts
|
||||||
CheckConnectivityRemoteHost
|
CheckConnectivityRemoteHost
|
||||||
sourceDir=$(EscapeSpaces "$sourceDir")
|
rsyncCmd="$(type -p $RSYNC_EXECUTABLE) $rsyncArgs $RSYNC_DRY_ARG $RSYNC_ATTR_ARGS $RSYNC_TYPE_ARGS $RSYNC_NO_RECURSE_ARGS $RSYNC_DELETE $RSYNC_PATTERNS $RSYNC_PARTIAL_EXCLUDE --rsync-path=\"env _REMOTE_TOKEN=$_REMOTE_TOKEN $RSYNC_PATH\" -e \"$RSYNC_SSH_CMD\" \"$REMOTE_USER@$REMOTE_HOST:'$sourceDir'\" \"$destinationDir\" > \"$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP\" 2>&1"
|
||||||
rsyncCmd="$(type -p $RSYNC_EXECUTABLE) $rsyncArgs $RSYNC_DRY_ARG $RSYNC_ATTR_ARGS $RSYNC_TYPE_ARGS $RSYNC_NO_RECURSE_ARGS $RSYNC_DELETE $RSYNC_PATTERNS $RSYNC_PARTIAL_EXCLUDE --rsync-path=\"env _REMOTE_TOKEN=$_REMOTE_TOKEN $RSYNC_PATH\" -e \"$RSYNC_SSH_CMD\" \"$REMOTE_USER@$REMOTE_HOST:$sourceDir\" \"$destinationDir\" > \"$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP\" 2>&1"
|
|
||||||
elif [ "$BACKUP_TYPE" == "push" ]; then
|
elif [ "$BACKUP_TYPE" == "push" ]; then
|
||||||
destinationDir=$(EscapeSpaces "$destinationDir")
|
|
||||||
_CreateDirectoryRemote "$destinationDir"
|
_CreateDirectoryRemote "$destinationDir"
|
||||||
CheckConnectivity3rdPartyHosts
|
CheckConnectivity3rdPartyHosts
|
||||||
CheckConnectivityRemoteHost
|
CheckConnectivityRemoteHost
|
||||||
rsyncCmd="$(type -p $RSYNC_EXECUTABLE) $rsyncArgs $RSYNC_DRY_ARG $RSYNC_ATTR_ARGS $RSYNC_TYPE_ARGS $RSYNC_NO_RECURSE_ARGS $RSYNC_DELETE $RSYNC_PATTERNS $RSYNC_PARTIAL_EXCLUDE --rsync-path=\"env _REMOTE_TOKEN=$_REMOTE_TOKEN $RSYNC_PATH\" -e \"$RSYNC_SSH_CMD\" \"$sourceDir\" \"$REMOTE_USER@$REMOTE_HOST:$destinationDir\" > \"$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP\" 2>&1"
|
rsyncCmd="$(type -p $RSYNC_EXECUTABLE) $rsyncArgs $RSYNC_DRY_ARG $RSYNC_ATTR_ARGS $RSYNC_TYPE_ARGS $RSYNC_NO_RECURSE_ARGS $RSYNC_DELETE $RSYNC_PATTERNS $RSYNC_PARTIAL_EXCLUDE --rsync-path=\"env _REMOTE_TOKEN=$_REMOTE_TOKEN $RSYNC_PATH\" -e \"$RSYNC_SSH_CMD\" \"$sourceDir\" \"$REMOTE_USER@$REMOTE_HOST:'$destinationDir'\" > \"$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP\" 2>&1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
Logger "Launching command [$rsyncCmd]." "DEBUG"
|
Logger "Launching command [$rsyncCmd]." "DEBUG"
|
||||||
@ -4305,7 +4303,7 @@ function Rsync {
|
|||||||
if [ $retval -ne 0 ]; then
|
if [ $retval -ne 0 ]; then
|
||||||
Logger "Failed to backup [$sourceDir] to [$destinationDir]." "ERROR"
|
Logger "Failed to backup [$sourceDir] to [$destinationDir]." "ERROR"
|
||||||
_LOGGER_SILENT=true Logger "Command was [$rsyncCmd]." "WARN"
|
_LOGGER_SILENT=true Logger "Command was [$rsyncCmd]." "WARN"
|
||||||
Logger "Truncated output:\n $(head -c16384 $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP)" "ERROR"
|
Logger "Truncated output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP")" "ERROR"
|
||||||
else
|
else
|
||||||
Logger "Truncated output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP")" "VERBOSE"
|
Logger "Truncated output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP")" "VERBOSE"
|
||||||
Logger "File backup succeed." "NOTICE"
|
Logger "File backup succeed." "NOTICE"
|
||||||
@ -4733,7 +4731,7 @@ ENDSSH
|
|||||||
ExecTasks $! "${FUNCNAME[0]}" false 0 0 1800 0 true $SLEEP_TIME $KEEP_LOGGING
|
ExecTasks $! "${FUNCNAME[0]}" false 0 0 1800 0 true $SLEEP_TIME $KEEP_LOGGING
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
Logger "Could not rotate backups in [$backupPath]." "ERROR"
|
Logger "Could not rotate backups in [$backupPath]." "ERROR"
|
||||||
Logger "Truncated output:\n$(head -c16384 $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP)" "ERROR"
|
Logger "Truncated output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP")" "ERROR"
|
||||||
else
|
else
|
||||||
Logger "Remote rotation succeed." "NOTICE"
|
Logger "Remote rotation succeed." "NOTICE"
|
||||||
fi ## Need to add a trivial sleep time to give ssh time to log to local file
|
fi ## Need to add a trivial sleep time to give ssh time to log to local file
|
||||||
@ -4976,7 +4974,7 @@ function GetCommandlineArguments {
|
|||||||
;;
|
;;
|
||||||
--parallel=*)
|
--parallel=*)
|
||||||
PARALLEL_ENCRYPTION_PROCESSES="${i##*=}"
|
PARALLEL_ENCRYPTION_PROCESSES="${i##*=}"
|
||||||
if [ $(IsNumeric $PARALLEL_ENCRYPTION_PROCESSES) -ne 1 ]; then
|
if [ $(IsNumeric "$PARALLEL_ENCRYPTION_PROCESSES") -ne 1 ]; then
|
||||||
Logger "Bogus --parallel value. Using only one CPU." "WARN"
|
Logger "Bogus --parallel value. Using only one CPU." "WARN"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
@ -5031,8 +5029,8 @@ fi
|
|||||||
# v2.3 config syntax compatibility
|
# v2.3 config syntax compatibility
|
||||||
UpdateBooleans
|
UpdateBooleans
|
||||||
|
|
||||||
if [ ! -w "$(dirname $LOG_FILE)" ]; then
|
if [ ! -w "$(dirname "$LOG_FILE")" ]; then
|
||||||
echo "Cannot write to log [$(dirname $LOG_FILE)]."
|
echo "Cannot write to log [$(dirname "$LOG_FILE")]."
|
||||||
else
|
else
|
||||||
Logger "Script begin, logging to [$LOG_FILE]." "DEBUG"
|
Logger "Script begin, logging to [$LOG_FILE]." "DEBUG"
|
||||||
fi
|
fi
|
||||||
|
1922
install.sh
1922
install.sh
File diff suppressed because it is too large
Load Diff
1906
obackup-batch.sh
1906
obackup-batch.sh
File diff suppressed because it is too large
Load Diff
148
obackup.sh
148
obackup.sh
@ -7,14 +7,14 @@ PROGRAM="obackup"
|
|||||||
AUTHOR="(C) 2013-2019 by Orsiris de Jong"
|
AUTHOR="(C) 2013-2019 by Orsiris de Jong"
|
||||||
CONTACT="http://www.netpower.fr/obackup - ozy@netpower.fr"
|
CONTACT="http://www.netpower.fr/obackup - ozy@netpower.fr"
|
||||||
PROGRAM_VERSION=2.1-dev-postRC1
|
PROGRAM_VERSION=2.1-dev-postRC1
|
||||||
PROGRAM_BUILD=2020031501
|
PROGRAM_BUILD=2020050302
|
||||||
IS_STABLE=true
|
IS_STABLE=true
|
||||||
|
|
||||||
CONFIG_FILE_REVISION_REQUIRED=2.1
|
CONFIG_FILE_REVISION_REQUIRED=2.1
|
||||||
|
|
||||||
|
|
||||||
_OFUNCTIONS_VERSION=2.3.0-RC4
|
_OFUNCTIONS_VERSION=2.3.0-RC4
|
||||||
_OFUNCTIONS_BUILD=2020031503
|
_OFUNCTIONS_BUILD=2020050301
|
||||||
_OFUNCTIONS_BOOTSTRAP=true
|
_OFUNCTIONS_BOOTSTRAP=true
|
||||||
|
|
||||||
if ! type "$BASH" > /dev/null; then
|
if ! type "$BASH" > /dev/null; then
|
||||||
@ -246,8 +246,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
|
||||||
@ -391,6 +391,7 @@ function GenericTrapQuit {
|
|||||||
exit $exitcode
|
exit $exitcode
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#### TrapQuit SUBSET END ####
|
||||||
|
|
||||||
function CleanUp {
|
function CleanUp {
|
||||||
# Exit controlmaster before it's socket gets deleted
|
# Exit controlmaster before it's socket gets deleted
|
||||||
@ -1627,11 +1628,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
|
||||||
@ -1664,15 +1661,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 {
|
||||||
@ -1690,6 +1682,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
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1886,7 +1886,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
|
||||||
}
|
}
|
||||||
@ -2516,7 +2516,7 @@ function _ListDatabasesLocal {
|
|||||||
Logger "Listing databases failed." "ERROR"
|
Logger "Listing databases failed." "ERROR"
|
||||||
_LOGGER_SILENT=true Logger "Command was [$sqlCmd]." "WARN"
|
_LOGGER_SILENT=true Logger "Command was [$sqlCmd]." "WARN"
|
||||||
if [ -f "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" ]; then
|
if [ -f "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" ]; then
|
||||||
Logger "Truncated output:\n$(head -c16384 $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP)" "ERROR"
|
Logger "Truncated output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP")" "ERROR"
|
||||||
fi
|
fi
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@ -2541,7 +2541,7 @@ function _ListDatabasesRemote {
|
|||||||
Logger "Listing databases failed." "ERROR"
|
Logger "Listing databases failed." "ERROR"
|
||||||
Logger "Command output: $sqlCmd" "WARN"
|
Logger "Command output: $sqlCmd" "WARN"
|
||||||
if [ -f "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" ]; then
|
if [ -f "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" ]; then
|
||||||
Logger "Truncated output:\n$(head -c16384 $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP)" "ERROR"
|
Logger "Truncated output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP")" "ERROR"
|
||||||
fi
|
fi
|
||||||
return $retval
|
return $retval
|
||||||
fi
|
fi
|
||||||
@ -2656,11 +2656,11 @@ function _ListRecursiveBackupDirectoriesLocal {
|
|||||||
if [ $retval -ne 0 ]; then
|
if [ $retval -ne 0 ]; then
|
||||||
Logger "Could not enumerate directories in [$directory]." "ERROR"
|
Logger "Could not enumerate directories in [$directory]." "ERROR"
|
||||||
_LOGGER_SILENT=true Logger "Command was [$cmd]." "WARN"
|
_LOGGER_SILENT=true Logger "Command was [$cmd]." "WARN"
|
||||||
if [ -f $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP ]; then
|
if [ -f "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" ]; then
|
||||||
Logger "Truncated output:\n$(head -c16384 $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP)" "ERROR"
|
Logger "Truncated output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP")" "ERROR"
|
||||||
fi
|
fi
|
||||||
if [ -f $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP ]; then
|
if [ -f "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP" ]; then
|
||||||
Logger "Truncated error output:\n$(head -c16384 $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP)" "ERROR"
|
Logger "Truncated error output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP")" "ERROR"
|
||||||
fi
|
fi
|
||||||
failuresPresent=true
|
failuresPresent=true
|
||||||
else
|
else
|
||||||
@ -2836,11 +2836,11 @@ exit $?
|
|||||||
ENDSSH
|
ENDSSH
|
||||||
retval=$?
|
retval=$?
|
||||||
if [ $retval -ne 0 ]; then
|
if [ $retval -ne 0 ]; then
|
||||||
if [ -f $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP ]; then
|
if [ -f "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" ]; then
|
||||||
Logger "Truncated output:\n$(head -c16384 $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP)" "ERROR"
|
Logger "Truncated output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP")" "ERROR"
|
||||||
fi
|
fi
|
||||||
if [ -f $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP ]; then
|
if [ -f "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP" ]; then
|
||||||
Logger "Truncated error output:\n$(head -c16384 $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP)" "ERROR"
|
Logger "Truncated error output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP")" "ERROR"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
return $retval
|
return $retval
|
||||||
@ -2938,19 +2938,19 @@ function _GetDirectoriesSizeLocal {
|
|||||||
Logger "Could not get files size for some or all local directories." "ERROR"
|
Logger "Could not get files size for some or all local directories." "ERROR"
|
||||||
_LOGGER_SILENT=true Logger "Command was [$cmd]." "WARN"
|
_LOGGER_SILENT=true Logger "Command was [$cmd]." "WARN"
|
||||||
if [ -f "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" ]; then
|
if [ -f "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" ]; then
|
||||||
Logger "Truncated output:\n$(head -c16384 $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP)" "ERROR"
|
Logger "Truncated output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP")" "ERROR"
|
||||||
fi
|
fi
|
||||||
if [ -f "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP" ]; then
|
if [ -f "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP" ]; then
|
||||||
Logger "Truncated error output:\n$(head -c16384 $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP)" "ERROR"
|
Logger "Truncated error output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP")" "ERROR"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
Logger "File size fetched successfully." "NOTICE"
|
Logger "File size fetched successfully." "NOTICE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -s "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" ]; then
|
if [ -s "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" ]; then
|
||||||
TOTAL_FILES_SIZE="$(head -c16384 $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP)"
|
TOTAL_FILES_SIZE="$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP")"
|
||||||
if [ $(IsInteger $TOTAL_FILES_SIZE) -eq 0 ]; then
|
if [ $(IsInteger "$TOTAL_FILES_SIZE") -eq 0 ]; then
|
||||||
TOTAL_FILES_SIZE="$(HumanToNumeric $TOTAL_FILES_SIZE)"
|
TOTAL_FILES_SIZE="$(HumanToNumeric "$TOTAL_FILES_SIZE")"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
TOTAL_FILES_SIZE=-1
|
TOTAL_FILES_SIZE=-1
|
||||||
@ -3097,18 +3097,18 @@ ENDSSH
|
|||||||
if [ $retval -ne 0 ] || [ -s "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP" ]; then
|
if [ $retval -ne 0 ] || [ -s "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP" ]; then
|
||||||
Logger "Could not get files size for some or all remote directories." "ERROR"
|
Logger "Could not get files size for some or all remote directories." "ERROR"
|
||||||
if [ -f "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" ]; then
|
if [ -f "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" ]; then
|
||||||
Logger "Truncated output:\n$(head -c16384 $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP)" "ERROR"
|
Logger "Truncated output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP")" "ERROR"
|
||||||
fi
|
fi
|
||||||
if [ -f "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP" ]; then
|
if [ -f "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP" ]; then
|
||||||
Logger "Truncated error output:\n$(head -c16384 $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP)" "ERROR"
|
Logger "Truncated error output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP")" "ERROR"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
Logger "File size fetched successfully." "NOTICE"
|
Logger "File size fetched successfully." "NOTICE"
|
||||||
fi
|
fi
|
||||||
if [ -s "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" ]; then
|
if [ -s "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" ]; then
|
||||||
TOTAL_FILES_SIZE="$(head -c16384 $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP)"
|
TOTAL_FILES_SIZE="$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP")"
|
||||||
if [ $(IsInteger $TOTAL_FILES_SIZE) -eq 0 ]; then
|
if [ $(IsInteger "$TOTAL_FILES_SIZE") -eq 0 ]; then
|
||||||
TOTAL_FILES_SIZE="$(HumanToNumeric $TOTAL_FILES_SIZE)"
|
TOTAL_FILES_SIZE="$(HumanToNumeric "$TOTAL_FILES_SIZE")"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
TOTAL_FILES_SIZE=-1
|
TOTAL_FILES_SIZE=-1
|
||||||
@ -3137,13 +3137,13 @@ function _CreateDirectoryLocal {
|
|||||||
|
|
||||||
if [ ! -d "$dirToCreate" ]; then
|
if [ ! -d "$dirToCreate" ]; then
|
||||||
# No sudo, you should have all necessary rights
|
# No sudo, you should have all necessary rights
|
||||||
mkdir -p "$dirToCreate" > $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP 2>&1 &
|
mkdir -p "$dirToCreate" > "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" 2>&1 &
|
||||||
ExecTasks $! "${FUNCNAME[0]}" false 0 0 720 1800 true $SLEEP_TIME $KEEP_LOGGING
|
ExecTasks $! "${FUNCNAME[0]}" false 0 0 720 1800 true $SLEEP_TIME $KEEP_LOGGING
|
||||||
retval=$?
|
retval=$?
|
||||||
if [ $retval -ne 0 ]; then
|
if [ $retval -ne 0 ]; then
|
||||||
Logger "Cannot create directory [$dirToCreate]" "CRITICAL"
|
Logger "Cannot create directory [$dirToCreate]" "CRITICAL"
|
||||||
if [ -f $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP ]; then
|
if [ -f "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" ]; then
|
||||||
Logger "Truncated output: $(head -c16384 $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP)" "ERROR"
|
Logger "Truncated output: $(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP")" "ERROR"
|
||||||
fi
|
fi
|
||||||
return $retval
|
return $retval
|
||||||
fi
|
fi
|
||||||
@ -3291,7 +3291,7 @@ ENDSSH
|
|||||||
ExecTasks $! "${FUNCNAME[0]}" false 0 0 720 1800 true $SLEEP_TIME $KEEP_LOGGING
|
ExecTasks $! "${FUNCNAME[0]}" false 0 0 720 1800 true $SLEEP_TIME $KEEP_LOGGING
|
||||||
retval=$?
|
retval=$?
|
||||||
if [ $retval -ne 0 ]; then
|
if [ $retval -ne 0 ]; then
|
||||||
Logger "Truncated output:\n$(head -c16384 $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP)" "ERROR"
|
Logger "Truncated output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP")" "ERROR"
|
||||||
return $retval
|
return $retval
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -3356,12 +3356,12 @@ function GetDiskSpaceLocal {
|
|||||||
if [ $retval -ne 0 ]; then
|
if [ $retval -ne 0 ]; then
|
||||||
DISK_SPACE=0
|
DISK_SPACE=0
|
||||||
Logger "Cannot get disk space in [$pathToCheck] on local system." "ERROR"
|
Logger "Cannot get disk space in [$pathToCheck] on local system." "ERROR"
|
||||||
Logger "Truncated output:\n$(head -c16384 $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP)" "ERROR"
|
Logger "Truncated output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP")" "ERROR"
|
||||||
else
|
else
|
||||||
DISK_SPACE=$(tail -1 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" | awk '{print $4}')
|
DISK_SPACE=$(tail -1 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" | awk '{print $4}')
|
||||||
DRIVE=$(tail -1 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" | awk '{print $1}')
|
DRIVE=$(tail -1 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" | awk '{print $1}')
|
||||||
if [ $(IsInteger $DISK_SPACE) -eq 0 ]; then
|
if [ $(IsInteger "$DISK_SPACE") -eq 0 ]; then
|
||||||
DISK_SPACE="$(HumanToNumeric $DISK_SPACE)"
|
DISK_SPACE="$(HumanToNumeric "$DISK_SPACE")"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
@ -3524,14 +3524,14 @@ ENDSSH
|
|||||||
if [ $retval -ne 0 ]; then
|
if [ $retval -ne 0 ]; then
|
||||||
DISK_SPACE=0
|
DISK_SPACE=0
|
||||||
Logger "Cannot get disk space in [$pathToCheck] on remote system." "ERROR"
|
Logger "Cannot get disk space in [$pathToCheck] on remote system." "ERROR"
|
||||||
Logger "Truncated output:\n$(head -c16384 $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP)" "ERROR"
|
Logger "Truncated output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP")" "ERROR"
|
||||||
Logger "Truncated output:\n$(head -c16384 $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP)" "ERROR"
|
Logger "Truncated output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP")" "ERROR"
|
||||||
return $retval
|
return $retval
|
||||||
else
|
else
|
||||||
DISK_SPACE=$(tail -1 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" | awk '{print $4}')
|
DISK_SPACE=$(tail -1 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" | awk '{print $4}')
|
||||||
DRIVE=$(tail -1 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" | awk '{print $1}')
|
DRIVE=$(tail -1 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" | awk '{print $1}')
|
||||||
if [ $(IsInteger $DISK_SPACE) -eq 0 ]; then
|
if [ $(IsInteger "$DISK_SPACE") -eq 0 ]; then
|
||||||
DISK_SPACE="$(HumanToNumeric $DISK_SPACE)"
|
DISK_SPACE="$(HumanToNumeric "$DISK_SPACE")"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -3705,7 +3705,7 @@ function _BackupDatabaseLocalToLocal {
|
|||||||
else
|
else
|
||||||
_LOGGER_SILENT=true Logger "Command was [$drySqlCmd]." "WARN"
|
_LOGGER_SILENT=true Logger "Command was [$drySqlCmd]." "WARN"
|
||||||
fi
|
fi
|
||||||
Logger "Truncated error output:\n$(head -c16384 $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP)" "ERROR"
|
Logger "Truncated error output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP")" "ERROR"
|
||||||
# Dirty fix for mysqldump return code not honored
|
# Dirty fix for mysqldump return code not honored
|
||||||
retval=1
|
retval=1
|
||||||
fi
|
fi
|
||||||
@ -3751,7 +3751,7 @@ function _BackupDatabaseLocalToRemote {
|
|||||||
else
|
else
|
||||||
_LOGGER_SILENT=true Logger "Command was [$drySqlCmd]." "WARN"
|
_LOGGER_SILENT=true Logger "Command was [$drySqlCmd]." "WARN"
|
||||||
fi
|
fi
|
||||||
Logger "Truncated error output:\n$(head -c16384 $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP)" "ERROR"
|
Logger "Truncated error output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP")" "ERROR"
|
||||||
# Dirty fix for mysqldump return code not honored
|
# Dirty fix for mysqldump return code not honored
|
||||||
retval=1
|
retval=1
|
||||||
fi
|
fi
|
||||||
@ -3797,7 +3797,7 @@ function _BackupDatabaseRemoteToLocal {
|
|||||||
else
|
else
|
||||||
_LOGGER_SILENT=true Logger "Command was [$drySqlCmd]." "WARN"
|
_LOGGER_SILENT=true Logger "Command was [$drySqlCmd]." "WARN"
|
||||||
fi
|
fi
|
||||||
Logger "Truncated error output:\n$(head -c16384 $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP)" "ERROR"
|
Logger "Truncated error output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP")" "ERROR"
|
||||||
# Dirty fix for mysqldump return code not honored
|
# Dirty fix for mysqldump return code not honored
|
||||||
retval=1
|
retval=1
|
||||||
fi
|
fi
|
||||||
@ -3900,13 +3900,13 @@ function EncryptFiles {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
Logger "Encrypting file [$sourceFile] to [$path/$file$cryptFileExtension]." "VERBOSE"
|
Logger "Encrypting file [$sourceFile] to [$path/$file$cryptFileExtension]." "VERBOSE"
|
||||||
if [ $(IsNumeric $PARALLEL_ENCRYPTION_PROCESSES) -eq 1 ] && [ "$PARALLEL_ENCRYPTION_PROCESSES" != "1" ]; then
|
if [ $(IsNumeric "$PARALLEL_ENCRYPTION_PROCESSES") -eq 1 ] && [ "$PARALLEL_ENCRYPTION_PROCESSES" != "1" ]; then
|
||||||
echo "$CRYPT_TOOL --batch --yes --out \"$path/$file$cryptFileExtension\" --recipient=\"$recipient\" --encrypt \"$sourceFile\" >> \"$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP\" 2>&1" >> "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.parallel.$SCRIPT_PID.$TSTAMP"
|
echo "$CRYPT_TOOL --batch --yes --out \"$path/$file$cryptFileExtension\" --recipient=\"$recipient\" --encrypt \"$sourceFile\" >> \"$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP\" 2>&1" >> "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.parallel.$SCRIPT_PID.$TSTAMP"
|
||||||
else
|
else
|
||||||
$CRYPT_TOOL --batch --yes --out "$path/$file$cryptFileExtension" --recipient="$recipient" --encrypt "$sourceFile" > "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" 2>&1
|
$CRYPT_TOOL --batch --yes --out "$path/$file$cryptFileExtension" --recipient="$recipient" --encrypt "$sourceFile" > "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" 2>&1
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
Logger "Cannot encrypt [$sourceFile]." "ERROR"
|
Logger "Cannot encrypt [$sourceFile]." "ERROR"
|
||||||
Logger "Truncated output:\n$(head -c16384 $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP)" "DEBUG"
|
Logger "Truncated output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP")" "DEBUG"
|
||||||
errorCounter=$((errorCounter+1))
|
errorCounter=$((errorCounter+1))
|
||||||
else
|
else
|
||||||
successCounter=$((successCounter+1))
|
successCounter=$((successCounter+1))
|
||||||
@ -3915,16 +3915,16 @@ function EncryptFiles {
|
|||||||
#TODO: This redirection does not work with busybox since there is no subshell support
|
#TODO: This redirection does not work with busybox since there is no subshell support
|
||||||
done < <($FIND_CMD "$filePath" $recursiveArgs -type f ! -name "*$cryptFileExtension" -print0)
|
done < <($FIND_CMD "$filePath" $recursiveArgs -type f ! -name "*$cryptFileExtension" -print0)
|
||||||
|
|
||||||
if [ $(IsNumeric $PARALLEL_ENCRYPTION_PROCESSES) -eq 1 ] && [ "$PARALLEL_ENCRYPTION_PROCESSES" != "1" ]; then
|
if [ $(IsNumeric "$PARALLEL_ENCRYPTION_PROCESSES") -eq 1 ] && [ "$PARALLEL_ENCRYPTION_PROCESSES" != "1" ]; then
|
||||||
# Handle batch mode where SOFT /HARD MAX EXEC TIME TOTAL is not defined
|
# Handle batch mode where SOFT /HARD MAX EXEC TIME TOTAL is not defined
|
||||||
if [ $(IsNumeric $SOFT_MAX_EXEC_TIME_TOTAL) -eq 1 ]; then
|
if [ $(IsNumeric "$SOFT_MAX_EXEC_TIME_TOTAL") -eq 1 ]; then
|
||||||
softMaxExecTime=$SOFT_MAX_EXEC_TIME_TOTAL
|
softMaxExecTime="$SOFT_MAX_EXEC_TIME_TOTAL"
|
||||||
else
|
else
|
||||||
softMaxExecTime=0
|
softMaxExecTime=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $(IsNumeric $HARD_MAX_EXEC_TIME_TOTAL) -eq 1 ]; then
|
if [ $(IsNumeric "$HARD_MAX_EXEC_TIME_TOTAL") -eq 1 ]; then
|
||||||
hardMaxExecTime=$HARD_MAX_EXEC_TIME_TOTAL
|
hardMaxExecTime="$HARD_MAX_EXEC_TIME_TOTAL"
|
||||||
else
|
else
|
||||||
hardMaxExecTime=0
|
hardMaxExecTime=0
|
||||||
fi
|
fi
|
||||||
@ -3933,7 +3933,7 @@ function EncryptFiles {
|
|||||||
if [ $retval -ne 0 ]; then
|
if [ $retval -ne 0 ]; then
|
||||||
Logger "Encryption error." "ERROR"
|
Logger "Encryption error." "ERROR"
|
||||||
# Output file is defined in ParallelExec
|
# Output file is defined in ParallelExec
|
||||||
Logger "Truncated output:\n$(head -c16384 $RUN_DIR/$PROGRAM.ExecTasks.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP)" "DEBUG"
|
Logger "Truncated output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.ExecTasks.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP")" "DEBUG"
|
||||||
fi
|
fi
|
||||||
successCounter=$(($(wc -l < "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.parallel.$SCRIPT_PID.$TSTAMP") - retval))
|
successCounter=$(($(wc -l < "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.parallel.$SCRIPT_PID.$TSTAMP") - retval))
|
||||||
errorCounter=$retval
|
errorCounter=$retval
|
||||||
@ -3973,7 +3973,7 @@ function DecryptFiles {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Detect if GnuPG >= 2.1 that does not allow automatic pin entry anymore
|
# Detect if GnuPG >= 2.1 that does not allow automatic pin entry anymore
|
||||||
cryptToolVersion=$($CRYPT_TOOL --version | head -1 | awk '{print $3}')
|
cryptToolVersion=$("$CRYPT_TOOL" --version | head -1 | awk '{print $3}')
|
||||||
cryptToolMajorVersion=${cryptToolVersion%%.*}
|
cryptToolMajorVersion=${cryptToolVersion%%.*}
|
||||||
cryptToolSubVersion=${cryptToolVersion#*.}
|
cryptToolSubVersion=${cryptToolVersion#*.}
|
||||||
cryptToolSubVersion=${cryptToolSubVersion%.*}
|
cryptToolSubVersion=${cryptToolSubVersion%.*}
|
||||||
@ -4000,14 +4000,14 @@ function DecryptFiles {
|
|||||||
while IFS= read -r -d $'\0' encryptedFile; do
|
while IFS= read -r -d $'\0' encryptedFile; do
|
||||||
Logger "Decrypting [$encryptedFile]." "VERBOSE"
|
Logger "Decrypting [$encryptedFile]." "VERBOSE"
|
||||||
|
|
||||||
if [ $(IsNumeric $PARALLEL_ENCRYPTION_PROCESSES) -eq 1 ] && [ "$PARALLEL_ENCRYPTION_PROCESSES" != "1" ]; then
|
if [ $(IsNumeric "$PARALLEL_ENCRYPTION_PROCESSES") -eq 1 ] && [ "$PARALLEL_ENCRYPTION_PROCESSES" != "1" ]; then
|
||||||
echo "$CRYPT_TOOL $options --out \"${encryptedFile%%$cryptFileExtension}\" $additionalParameters $secret --decrypt \"$encryptedFile\" >> \"$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP\" 2>&1" >> "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.parallel.$SCRIPT_PID.$TSTAMP"
|
echo "$CRYPT_TOOL $options --out \"${encryptedFile%%$cryptFileExtension}\" $additionalParameters $secret --decrypt \"$encryptedFile\" >> \"$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP\" 2>&1" >> "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.parallel.$SCRIPT_PID.$TSTAMP"
|
||||||
else
|
else
|
||||||
$CRYPT_TOOL $options --out "${encryptedFile%%$cryptFileExtension}" $additionalParameters $secret --decrypt "$encryptedFile" > "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" 2>&1
|
$CRYPT_TOOL $options --out "${encryptedFile%%$cryptFileExtension}" $additionalParameters $secret --decrypt "$encryptedFile" > "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP" 2>&1
|
||||||
retval=$?
|
retval=$?
|
||||||
if [ $retval -ne 0 ]; then
|
if [ $retval -ne 0 ]; then
|
||||||
Logger "Cannot decrypt [$encryptedFile]." "ERROR"
|
Logger "Cannot decrypt [$encryptedFile]." "ERROR"
|
||||||
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"
|
||||||
errorCounter=$((errorCounter+1))
|
errorCounter=$((errorCounter+1))
|
||||||
else
|
else
|
||||||
successCounter=$((successCounter+1))
|
successCounter=$((successCounter+1))
|
||||||
@ -4019,15 +4019,15 @@ function DecryptFiles {
|
|||||||
fi
|
fi
|
||||||
done < <($FIND_CMD "$filePath" -type f -name "*$cryptFileExtension" -print0)
|
done < <($FIND_CMD "$filePath" -type f -name "*$cryptFileExtension" -print0)
|
||||||
|
|
||||||
if [ $(IsNumeric $PARALLEL_ENCRYPTION_PROCESSES) -eq 1 ] && [ "$PARALLEL_ENCRYPTION_PROCESSES" != "1" ]; then
|
if [ $(IsNumeric "$PARALLEL_ENCRYPTION_PROCESSES") -eq 1 ] && [ "$PARALLEL_ENCRYPTION_PROCESSES" != "1" ]; then
|
||||||
# Handle batch mode where SOFT /HARD MAX EXEC TIME TOTAL is not defined
|
# Handle batch mode where SOFT /HARD MAX EXEC TIME TOTAL is not defined
|
||||||
if [ $(IsNumeric $SOFT_MAX_EXEC_TIME_TOTAL) -eq 1 ]; then
|
if [ $(IsNumeric "$SOFT_MAX_EXEC_TIME_TOTAL") -eq 1 ]; then
|
||||||
softMaxExecTime=$SOFT_MAX_EXEC_TIME_TOTAL
|
softMaxExecTime=$SOFT_MAX_EXEC_TIME_TOTAL
|
||||||
else
|
else
|
||||||
softMaxExecTime=0
|
softMaxExecTime=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $(IsNumeric $HARD_MAX_EXEC_TIME_TOTAL) -eq 1 ]; then
|
if [ $(IsNumeric "$HARD_MAX_EXEC_TIME_TOTAL") -eq 1 ]; then
|
||||||
hardMaxExecTime=$HARD_MAX_EXEC_TIME_TOTAL
|
hardMaxExecTime=$HARD_MAX_EXEC_TIME_TOTAL
|
||||||
else
|
else
|
||||||
hardMaxExecTime=0
|
hardMaxExecTime=0
|
||||||
@ -4038,7 +4038,7 @@ function DecryptFiles {
|
|||||||
if [ $retval -ne 0 ]; then
|
if [ $retval -ne 0 ]; then
|
||||||
Logger "Decrypting error.." "ERROR"
|
Logger "Decrypting error.." "ERROR"
|
||||||
# Output file is defined in ParallelExec
|
# Output file is defined in ParallelExec
|
||||||
Logger "Truncated output:\n$(head -c16384 $RUN_DIR/$PROGRAM.ParallelExec.EncryptFiles.$SCRIPT_PID.$TSTAMP)" "DEBUG"
|
Logger "Truncated output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.ParallelExec.EncryptFiles.$SCRIPT_PID.$TSTAMP")" "DEBUG"
|
||||||
fi
|
fi
|
||||||
successCounter=$(($(wc -l < "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.parallel.$SCRIPT_PID.$TSTAMP") - retval))
|
successCounter=$(($(wc -l < "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.parallel.$SCRIPT_PID.$TSTAMP") - retval))
|
||||||
errorCounter=$retval
|
errorCounter=$retval
|
||||||
@ -4083,14 +4083,12 @@ function Rsync {
|
|||||||
_CreateDirectoryLocal "$destinationDir"
|
_CreateDirectoryLocal "$destinationDir"
|
||||||
CheckConnectivity3rdPartyHosts
|
CheckConnectivity3rdPartyHosts
|
||||||
CheckConnectivityRemoteHost
|
CheckConnectivityRemoteHost
|
||||||
sourceDir=$(EscapeSpaces "$sourceDir")
|
rsyncCmd="$(type -p $RSYNC_EXECUTABLE) $rsyncArgs $RSYNC_DRY_ARG $RSYNC_ATTR_ARGS $RSYNC_TYPE_ARGS $RSYNC_NO_RECURSE_ARGS $RSYNC_DELETE $RSYNC_PATTERNS $RSYNC_PARTIAL_EXCLUDE --rsync-path=\"env _REMOTE_TOKEN=$_REMOTE_TOKEN $RSYNC_PATH\" -e \"$RSYNC_SSH_CMD\" \"$REMOTE_USER@$REMOTE_HOST:'$sourceDir'\" \"$destinationDir\" > \"$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP\" 2>&1"
|
||||||
rsyncCmd="$(type -p $RSYNC_EXECUTABLE) $rsyncArgs $RSYNC_DRY_ARG $RSYNC_ATTR_ARGS $RSYNC_TYPE_ARGS $RSYNC_NO_RECURSE_ARGS $RSYNC_DELETE $RSYNC_PATTERNS $RSYNC_PARTIAL_EXCLUDE --rsync-path=\"env _REMOTE_TOKEN=$_REMOTE_TOKEN $RSYNC_PATH\" -e \"$RSYNC_SSH_CMD\" \"$REMOTE_USER@$REMOTE_HOST:$sourceDir\" \"$destinationDir\" > \"$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP\" 2>&1"
|
|
||||||
elif [ "$BACKUP_TYPE" == "push" ]; then
|
elif [ "$BACKUP_TYPE" == "push" ]; then
|
||||||
destinationDir=$(EscapeSpaces "$destinationDir")
|
|
||||||
_CreateDirectoryRemote "$destinationDir"
|
_CreateDirectoryRemote "$destinationDir"
|
||||||
CheckConnectivity3rdPartyHosts
|
CheckConnectivity3rdPartyHosts
|
||||||
CheckConnectivityRemoteHost
|
CheckConnectivityRemoteHost
|
||||||
rsyncCmd="$(type -p $RSYNC_EXECUTABLE) $rsyncArgs $RSYNC_DRY_ARG $RSYNC_ATTR_ARGS $RSYNC_TYPE_ARGS $RSYNC_NO_RECURSE_ARGS $RSYNC_DELETE $RSYNC_PATTERNS $RSYNC_PARTIAL_EXCLUDE --rsync-path=\"env _REMOTE_TOKEN=$_REMOTE_TOKEN $RSYNC_PATH\" -e \"$RSYNC_SSH_CMD\" \"$sourceDir\" \"$REMOTE_USER@$REMOTE_HOST:$destinationDir\" > \"$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP\" 2>&1"
|
rsyncCmd="$(type -p $RSYNC_EXECUTABLE) $rsyncArgs $RSYNC_DRY_ARG $RSYNC_ATTR_ARGS $RSYNC_TYPE_ARGS $RSYNC_NO_RECURSE_ARGS $RSYNC_DELETE $RSYNC_PATTERNS $RSYNC_PARTIAL_EXCLUDE --rsync-path=\"env _REMOTE_TOKEN=$_REMOTE_TOKEN $RSYNC_PATH\" -e \"$RSYNC_SSH_CMD\" \"$sourceDir\" \"$REMOTE_USER@$REMOTE_HOST:'$destinationDir'\" > \"$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP\" 2>&1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
Logger "Launching command [$rsyncCmd]." "DEBUG"
|
Logger "Launching command [$rsyncCmd]." "DEBUG"
|
||||||
@ -4100,7 +4098,7 @@ function Rsync {
|
|||||||
if [ $retval -ne 0 ]; then
|
if [ $retval -ne 0 ]; then
|
||||||
Logger "Failed to backup [$sourceDir] to [$destinationDir]." "ERROR"
|
Logger "Failed to backup [$sourceDir] to [$destinationDir]." "ERROR"
|
||||||
_LOGGER_SILENT=true Logger "Command was [$rsyncCmd]." "WARN"
|
_LOGGER_SILENT=true Logger "Command was [$rsyncCmd]." "WARN"
|
||||||
Logger "Truncated output:\n $(head -c16384 $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP)" "ERROR"
|
Logger "Truncated output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP")" "ERROR"
|
||||||
else
|
else
|
||||||
Logger "Truncated output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP")" "VERBOSE"
|
Logger "Truncated output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP")" "VERBOSE"
|
||||||
Logger "File backup succeed." "NOTICE"
|
Logger "File backup succeed." "NOTICE"
|
||||||
@ -4515,7 +4513,7 @@ ENDSSH
|
|||||||
ExecTasks $! "${FUNCNAME[0]}" false 0 0 1800 0 true $SLEEP_TIME $KEEP_LOGGING
|
ExecTasks $! "${FUNCNAME[0]}" false 0 0 1800 0 true $SLEEP_TIME $KEEP_LOGGING
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
Logger "Could not rotate backups in [$backupPath]." "ERROR"
|
Logger "Could not rotate backups in [$backupPath]." "ERROR"
|
||||||
Logger "Truncated output:\n$(head -c16384 $RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP)" "ERROR"
|
Logger "Truncated output:\n$(head -c16384 "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.$SCRIPT_PID.$TSTAMP")" "ERROR"
|
||||||
else
|
else
|
||||||
Logger "Remote rotation succeed." "NOTICE"
|
Logger "Remote rotation succeed." "NOTICE"
|
||||||
fi ## Need to add a trivial sleep time to give ssh time to log to local file
|
fi ## Need to add a trivial sleep time to give ssh time to log to local file
|
||||||
@ -4754,7 +4752,7 @@ function GetCommandlineArguments {
|
|||||||
;;
|
;;
|
||||||
--parallel=*)
|
--parallel=*)
|
||||||
PARALLEL_ENCRYPTION_PROCESSES="${i##*=}"
|
PARALLEL_ENCRYPTION_PROCESSES="${i##*=}"
|
||||||
if [ $(IsNumeric $PARALLEL_ENCRYPTION_PROCESSES) -ne 1 ]; then
|
if [ $(IsNumeric "$PARALLEL_ENCRYPTION_PROCESSES") -ne 1 ]; then
|
||||||
Logger "Bogus --parallel value. Using only one CPU." "WARN"
|
Logger "Bogus --parallel value. Using only one CPU." "WARN"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
@ -4809,8 +4807,8 @@ fi
|
|||||||
# v2.3 config syntax compatibility
|
# v2.3 config syntax compatibility
|
||||||
UpdateBooleans
|
UpdateBooleans
|
||||||
|
|
||||||
if [ ! -w "$(dirname $LOG_FILE)" ]; then
|
if [ ! -w "$(dirname "$LOG_FILE")" ]; then
|
||||||
echo "Cannot write to log [$(dirname $LOG_FILE)]."
|
echo "Cannot write to log [$(dirname "$LOG_FILE")]."
|
||||||
else
|
else
|
||||||
Logger "Script begin, logging to [$LOG_FILE]." "DEBUG"
|
Logger "Script begin, logging to [$LOG_FILE]." "DEBUG"
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user