This commit is contained in:
Philippe Caseiro 2018-09-03 14:01:45 +02:00
commit 7a99473352
5 changed files with 59 additions and 1 deletions

View File

@ -30,6 +30,9 @@
<variable name="dbEnable" type='oui/non' description='Activer le serveur de base de données MariaDB'> <variable name="dbEnable" type='oui/non' description='Activer le serveur de base de données MariaDB'>
<value>non</value> <value>non</value>
</variable> </variable>
<variable name="dbEnableBackup" type='oui/non' description='Activer la sauvegarde sur le serveur de base de données MariaDB'>
<value>non</value>
</variable>
</family> </family>
<family name="Database"> <family name="Database">
<variable name='dbEnableCluster' type='oui/non' description="Activer la mise en grappe MariaDB Galera ?"> <variable name='dbEnableCluster' type='oui/non' description="Activer la mise en grappe MariaDB Galera ?">

View File

@ -1 +1,3 @@
creolefuncs_DATA_DIR := $(DESTDIR)/usr/share/creole/funcs creolefuncs_DATA_DIR := $(DESTDIR)/usr/share/creole/funcs
schedule_extra_DATA_DIR := $(DESTDIR)/usr/share/eole/creole/extra/schedule/
schedule_config_DATA_DIR := $(DESTDIR)/usr/share/eole/schedule/

View File

@ -0,0 +1,7 @@
# 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

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<creole>
<variables>
<family name="mysql" description="Exportation des bases de données MySQL">
<variable name="description" type="string" hidden="True"><value>Exportation des bases MySQL</value></variable>
<variable name="day" type="schedule" description="Périodicité d'exécution"><value>daily</value></variable>
<variable name="mode" type="schedulemod" hidden="True"><value>pre</value></variable>
</family>
</variables>
<constraints>
<fill name='calc_multi_condition' target='schedule.mysql.day'>
<param>non</param>
<param type='eole' name='condition_1'>dbEnableBackup</param>
<param name='match'>none</param>
<param name='mismatch'>daily</param>
</fill>
</constraints>
</creole>

27
schedule_scripts/mysql Normal file
View File

@ -0,0 +1,27 @@
#!/bin/bash
set -e
DESC="Exportation des bases MySQL"
. /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/mariadb.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/mariadb.cnf --databases $databasename --flush-privileges --create-options -Q -c $OPTION 2>/dev/null"
CreoleRun "$CMD" mysql > $MYSQLSAVDIR/$databasename.sql
;;
esac
done