Prise en charge du dump des bases mariadb par schedule et bareos + copier des dump sur le partage nfs
This commit is contained in:
parent
24552b6ccc
commit
196a4b41f2
|
@ -1 +1,3 @@
|
|||
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/
|
||||
|
|
|
@ -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
|
|
@ -0,0 +1,18 @@
|
|||
<?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 name='match'>none</param>
|
||||
<param name='mismatch'>daily</param>
|
||||
</fill>
|
||||
</constraints>
|
||||
</creole>
|
|
@ -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
|
Loading…
Reference in New Issue