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