diff --git a/schedule_extra/01_mariadb.xml b/schedule/extra/01_mariadb.xml similarity index 100% rename from schedule_extra/01_mariadb.xml rename to schedule/extra/01_mariadb.xml diff --git a/schedule/scripts/mariadb b/schedule/scripts/mariadb new file mode 100644 index 0000000..161103a --- /dev/null +++ b/schedule/scripts/mariadb @@ -0,0 +1,27 @@ +#!/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/mariadbBackup.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/mariadbBackup.cnf --databases $databasename --flush-privileges --create-options -Q -c $OPTION 2>/dev/null > $MYSQLSAVDIR/$databasename.sql + ;; + esac +done + +exit 0 diff --git a/schedule_config/config.sh b/schedule_config/config.sh deleted file mode 100644 index 2562ef3..0000000 --- a/schedule_config/config.sh +++ /dev/null @@ -1,7 +0,0 @@ -# Configuration commune aux scripts schedule -# Configuration de base modifiée pour copier dans le partage nfs plutôt que /home - -SAVDIR=/mnt/sauvegardes/ -# pour que l'affichage de [ ok ] soit ok -export TERM='dumb' -umask 0077 diff --git a/schedule_scripts/mariadb b/schedule_scripts/mariadb deleted file mode 100644 index 0dda3ea..0000000 --- a/schedule_scripts/mariadb +++ /dev/null @@ -1,27 +0,0 @@ -#!/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 -mkdir -p $MYSQLSAVDIR - -CMD="mysql --defaults-file=/etc/mysql/mariadbBackup.cnf -e 'show databases' | grep -v '^Database$'" -DATABASES=$(CreoleRun "$CMD" mysql) -for databasename in $DATABASES; do - case "$databasename" in - information_schema|performance_schema|bareos) - continue - ;; - *) - CMD="mysqldump --defaults-file=/etc/mysql/mariadbBackup.cnf --databases $databasename --flush-privileges --create-options -Q -c $OPTION 2>/dev/null" - CreoleRun "$CMD" mysql > $MYSQLSAVDIR/$databasename.sql - ;; - esac -done