1
0
mirror of https://github.com/deajan/obackup.git synced 2024-11-12 19:03:42 +01:00

Fixed sql dry mode output and compression level

This commit is contained in:
deajan 2014-12-21 22:12:47 +01:00
parent ec7140e963
commit 7ee1872718
2 changed files with 13 additions and 7 deletions

View File

@ -16,11 +16,14 @@ UNDER WORK
- Commands like cp should have their stderr redirected to log file
- Mysqldump must be checked for not telling success if a table is damaged (also check for event table error)
- Mysqldump commands error msg must be logged
CHANGELOG
---------
- Fixed ignoring compression level in conf file
- Fixed dry mode sql backup output
- Prevented triggering TrapError if there are no child processes to terminate on TrapQuit
- Improved mysql debug logs
- Prevent creation of backup-id less log file when DEBUG is set

View File

@ -5,7 +5,7 @@
AUTHOR="(L) 2013-2014 by Orsiris \"Ozy\" de Jong"
CONTACT="http://www.netpower.fr/osync - ozy@netpower.fr"
PROGRAM_VERSION=1.84RC4
PROGRAM_BUILD=2811201403
PROGRAM_BUILD=2112201401
## type doesn't work on platforms other than linux (bash). If if doesn't work, always assume output is not a zero exitcode
if ! type -p "$BASH" > /dev/null
@ -791,7 +791,7 @@ function BackupDatabase
LogError "Connectivity test failed. Stopping current task."
exit 1
fi
dry_sql_cmd="$SSH_CMD mysqldump -u $SQL_USER --skip-lock-tables --single-transaction --database $1 > /dev/null 2>&1"
dry_sql_cmd="$SSH_CMD mysqldump -u $SQL_USER --skip-lock-tables --single-transaction --database $1"
sql_cmd="$SSH_CMD mysqldump -u $SQL_USER --skip-lock-tables --single-transaction --database $1 $COMPRESSION_PROGRAM $COMPRESSION_OPTIONS > $LOCAL_SQL_STORAGE/$1.sql$COMPRESSION_EXTENSION"
elif [ "$REMOTE_BACKUP" == "yes" ] && [ "$COMPRESSION_REMOTE" == "yes" ]
then
@ -801,19 +801,19 @@ function BackupDatabase
LogError "Connectivity test failed. Stopping current task."
exit 1
fi
dry_sql_cmd="$SSH_CMD \"mysqldump -u $SQL_USER --skip-lock-tables --single-transaction --database $1 $COMPRESSION_PROGRAM $COMPRESSION_OPTIONS\" > /dev/null 2>&1"
dry_sql_cmd="$SSH_CMD \"mysqldump -u $SQL_USER --skip-lock-tables --single-transaction --database $1 $COMPRESSION_PROGRAM $COMPRESSION_OPTIONS\""
sql_cmd="$SSH_CMD \"mysqldump -u $SQL_USER --skip-lock-tables --single-transaction --database $1 $COMPRESSION_PROGRAM $COMPRESSION_OPTIONS\" > $LOCAL_SQL_STORAGE/$1.sql$COMPRESSION_EXTENSION"
else
dry_sql_cmd="mysqldump -u $SQL_USER --skip-lock-tables --single-transaction --database $1 $COMPRESSION_PROGRAM $COMPRESSION_OPTIONS > /dev/null 2>&1"
dry_sql_cmd="mysqldump -u $SQL_USER --skip-lock-tables --single-transaction --database $1 $COMPRESSION_PROGRAM $COMPRESSION_OPTIONS"
sql_cmd="mysqldump -u $SQL_USER --skip-lock-tables --single-transaction --database $1 $COMPRESSION_PROGRAM $COMPRESSION_OPTIONS > $LOCAL_SQL_STORAGE/$1.sql$COMPRESSION_EXTENSION"
fi
LogDebug "SQL_CMD: $sql_cmd"
if [ $dryrun -ne 1 ]
then
LogDebug "SQL_CMD: $sql_cmd"
eval "$sql_cmd 2>&1"
else
LogDebug "SQL_CMD: $dry_sql_cmd"
eval "$dry_sql_cmd"
fi
exit $?
@ -1289,7 +1289,10 @@ function Init
RSYNC_ARGS=$RSYNC_ARGS" --force"
## Set compression executable and extension
COMPRESSION_LEVEL=9
if [ "$COMPRESSION_LEVEL" == "" ]
then
COMPRESSION_LEVEL=9
fi
if type -p xz > /dev/null 2>&1
then
COMPRESSION_PROGRAM="| xz -$COMPRESSION_LEVEL"