eole-mariadb/schedule/scripts/mariadb

28 lines
697 B
Plaintext
Raw Normal View History

#!/bin/bash
set -e
DESC="Exportation des bases MariaDB"
. /usr/share/eole/schedule/config.sh
MYSQLSAVDIR=$SAVDIR/sql
OPTION="--lock-tables"
2019-04-18 17:00:07 +02:00
rm -f $MYSQLSAVDIR/*.sql || true
mkdir -p $MYSQLSAVDIR
2019-04-18 17:00:07 +02:00
DATABASES=$(mysql --defaults-file=/etc/mysql/mariadbBackup.cnf -e 'show databases' | grep -v '^Database$')
for databasename in $DATABASES; do
case "$databasename" in
information_schema|performance_schema|bareos)
continue
;;
*)
2019-04-18 17:00:07 +02:00
mysqldump --defaults-file=/etc/mysql/mariadbBackup.cnf --databases $databasename --flush-privileges --create-options -Q -c $OPTION 2>/dev/null > $MYSQLSAVDIR/$databasename.sql
;;
esac
done
2019-04-18 17:00:07 +02:00
exit 0