From e545562d2674e0e429f154954cb7f8265285d0d8 Mon Sep 17 00:00:00 2001 From: "tommaso.piccioli" Date: Wed, 17 May 2017 13:00:51 +0200 Subject: [PATCH] fix to correctly handle the information_schema db dump --- mysql/files/mysql-backup.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) mode change 100644 => 100755 mysql/files/mysql-backup.sh diff --git a/mysql/files/mysql-backup.sh b/mysql/files/mysql-backup.sh old mode 100644 new mode 100755 index 77d69221..0cdce8c5 --- a/mysql/files/mysql-backup.sh +++ b/mysql/files/mysql-backup.sh @@ -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