fix to correctly handle the information_schema db dump

This commit is contained in:
Tommaso Piccioli 2017-05-17 13:00:51 +02:00
parent ed83059bc4
commit e545562d26
1 changed files with 11 additions and 3 deletions

14
mysql/files/mysql-backup.sh Normal file → Executable file
View File

@ -1,5 +1,8 @@
#!/bin/bash
#echo "`date` mysql DUMP temporarly excluded (by Tom)"
#exit 1
RETVAL=0
MY_BACKUP_USE_NAGIOS="False"
@ -41,9 +44,14 @@ if [ ! -f $LOCKFILE ] ; then
if [ "${MY_BACKUP_USE_NAGIOS}" == "True" ] ; then
> $NAGIOS_LOG
fi
for db in $( mysql -Bse "show databases;" | grep -v $EXCLUDE_LIST ) ; do
mysqldump -f --flush-privileges --opt $db > $MY_BACKUP_DIR/history/${db}.sql.${SAVE_TIME} 2> $MY_BACKUP_LOG_DIR/$db.log
DUMP_RESULT=$?
for db in $( mysql -Bse "show databases;" | egrep -v $EXCLUDE_LIST ) ; do
if [ "$db" == "information_schema" ]; then
mysqldump --single-transaction -f --flush-privileges --opt $db > $MY_BACKUP_DIR/history/${db}.sql.${SAVE_TIME} 2> $MY_BACKUP_LOG_DIR/$db.log
DUMP_RESULT=$?
else
mysqldump -f --flush-privileges --opt $db > $MY_BACKUP_DIR/history/${db}.sql.${SAVE_TIME} 2> $MY_BACKUP_LOG_DIR/$db.log
DUMP_RESULT=$?
fi
chmod 600 $MY_BACKUP_DIR/history/${db}.sql.${SAVE_TIME}
if [ "${MY_BACKUP_USE_NAGIOS}" == "True" ] ; then
if [ $DUMP_RESULT -ne 0 ] ; then