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

Fixed double sql backup on errro

This commit is contained in:
root 2020-03-15 23:23:05 +01:00
parent 30ea816a71
commit 823c6034db

View File

@ -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=2019080901 PROGRAM_BUILD=2020031501
IS_STABLE=true IS_STABLE=true
CONFIG_FILE_REVISION_REQUIRED=2.1 CONFIG_FILE_REVISION_REQUIRED=2.1
@ -1052,10 +1052,8 @@ function _BackupDatabaseLocalToLocal {
if [ -s "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP" ]; then if [ -s "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP" ]; then
if [ $_DRYRUN == false ]; then if [ $_DRYRUN == false ]; then
_LOGGER_SILENT=true Logger "Command was [$sqlCmd]." "WARN" _LOGGER_SILENT=true Logger "Command was [$sqlCmd]." "WARN"
eval "$sqlCmd" &
else else
_LOGGER_SILENT=true Logger "Command was [$drySqlCmd]." "WARN" _LOGGER_SILENT=true Logger "Command was [$drySqlCmd]." "WARN"
eval "$drySqlCmd" &
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
@ -1101,10 +1099,8 @@ function _BackupDatabaseLocalToRemote {
if [ -s "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP" ]; then if [ -s "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP" ]; then
if [ $_DRYRUN == false ]; then if [ $_DRYRUN == false ]; then
_LOGGER_SILENT=true Logger "Command was [$sqlCmd]." "WARN" _LOGGER_SILENT=true Logger "Command was [$sqlCmd]." "WARN"
eval "$sqlCmd" &
else else
_LOGGER_SILENT=true Logger "Command was [$drySqlCmd]." "WARN" _LOGGER_SILENT=true Logger "Command was [$drySqlCmd]." "WARN"
eval "$drySqlCmd" &
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
@ -1150,10 +1146,8 @@ function _BackupDatabaseRemoteToLocal {
if [ -s "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP" ]; then if [ -s "$RUN_DIR/$PROGRAM.${FUNCNAME[0]}.error.$SCRIPT_PID.$TSTAMP" ]; then
if [ $_DRYRUN == false ]; then if [ $_DRYRUN == false ]; then
_LOGGER_SILENT=true Logger "Command was [$sqlCmd]." "WARN" _LOGGER_SILENT=true Logger "Command was [$sqlCmd]." "WARN"
eval "$sqlCmd" &
else else
_LOGGER_SILENT=true Logger "Command was [$drySqlCmd]." "WARN" _LOGGER_SILENT=true Logger "Command was [$drySqlCmd]." "WARN"
eval "$drySqlCmd" &
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