eole-mariadb/schedule/scripts/mariadb

28 lines
671 B
Bash

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