forked from ISTI-ansible-roles/ansible-roles
fix to correctly handle the information_schema db dump
This commit is contained in:
parent
ed83059bc4
commit
e545562d26
|
@ -1,5 +1,8 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
#echo "`date` mysql DUMP temporarly excluded (by Tom)"
|
||||||
|
#exit 1
|
||||||
|
|
||||||
RETVAL=0
|
RETVAL=0
|
||||||
|
|
||||||
MY_BACKUP_USE_NAGIOS="False"
|
MY_BACKUP_USE_NAGIOS="False"
|
||||||
|
@ -41,9 +44,14 @@ if [ ! -f $LOCKFILE ] ; then
|
||||||
if [ "${MY_BACKUP_USE_NAGIOS}" == "True" ] ; then
|
if [ "${MY_BACKUP_USE_NAGIOS}" == "True" ] ; then
|
||||||
> $NAGIOS_LOG
|
> $NAGIOS_LOG
|
||||||
fi
|
fi
|
||||||
for db in $( mysql -Bse "show databases;" | grep -v $EXCLUDE_LIST ) ; do
|
for db in $( mysql -Bse "show databases;" | egrep -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
|
if [ "$db" == "information_schema" ]; then
|
||||||
DUMP_RESULT=$?
|
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}
|
chmod 600 $MY_BACKUP_DIR/history/${db}.sql.${SAVE_TIME}
|
||||||
if [ "${MY_BACKUP_USE_NAGIOS}" == "True" ] ; then
|
if [ "${MY_BACKUP_USE_NAGIOS}" == "True" ] ; then
|
||||||
if [ $DUMP_RESULT -ne 0 ] ; then
|
if [ $DUMP_RESULT -ne 0 ] ; then
|
||||||
|
|
Loading…
Reference in New Issue