Merge branch 'master' into dist/eole/2.7.0/master

This commit is contained in:
vincent 2019-05-16 10:38:42 +02:00
commit 2f5f17adc4
5 changed files with 29 additions and 36 deletions

View File

@ -28,6 +28,8 @@ then
previousUsers=($(awk -F ':' '{print $1}' ${readerfile} )) previousUsers=($(awk -F ':' '{print $1}' ${readerfile} ))
index=0
for user in ${accounts[@]} for user in ${accounts[@]}
do do
PASS=$(awk -F ':' "/${user}:/ {print \$2}" ${readerfile}) PASS=$(awk -F ':' "/${user}:/ {print \$2}" ${readerfile})
@ -54,7 +56,6 @@ then
done done
fi fi
index=0
for hst in ${hostsList[@]} for hst in ${hostsList[@]}
do do
SQL="DROP USER IF EXISTS '${user}'@'${hst}';" SQL="DROP USER IF EXISTS '${user}'@'${hst}';"
@ -86,4 +87,3 @@ then
fi fi
exit 0 exit 0

27
schedule/scripts/mariadb Normal file
View File

@ -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

View File

@ -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

View File

@ -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