En fin de compte j’ai fais la manip manuellement et changer ma méthode de sauvegarde.
[code]#!/bin/sh
echo $$ > /var/run/backup_sql.pid
DATE=date +"%y-%d-%m"
DEBIAN_SQL_CONF_FILE="/etc/mysql/debian.cnf"
SQL_DUMP_FILE="/root/server.sql"
LOGIN="head -5 $DEBIAN_SQL_CONF_FILE | grep 'user' | tr -s " " | cut -d " " -f 3
“
PASSWORD=”head -5 $DEBIAN_SQL_CONF_FILE | grep 'password' | tr -s " " | cut -d " " -f 3
“
SAVE_DIR=”/home/mysql"
if [ $# -eq 0 ];then
LOG_FILE="/var/log/backup_sql.log"
else
LOG_FILE=$1
fi
if [ -d $SAVE_DIR ]; then
rm $SAVE_DIR/*.tar.gz
else mkdir $SAVE_DIR/
fi
echo date +"%y-%m-%d %H:%M:%S"
“Backup started” >> $LOG_FILE
mysqldump -u $LOGIN -p$PASSWORD --all-databases > $SQL_DUMP_FILE
tar -czf $SAVE_DIR/serveur.tar.gz $SQL_DUMP_FILE &> /dev/null
rm $SQL_DUMP_FILE
Sauvegarde individuel des bases de donnees
echo ‘show databases;’ > /tmp/req
mysql -u $LOGIN -p$PASSWORD < /tmp/req > listdb
sed -i.BAK ‘1d’ listdb
while read ligne
do
echo date +"%y-%m-%d %H:%M:%S"
“Backup of” $ligne " started" >> $LOG_FILE
mysqldump -u $LOGIN -p$PASSWORD $ligne > $SAVE_DIR/$ligne.sql
tar -czf $SAVE_DIR/$ligne.tar.gz $SAVE_DIR/$ligne.sql &> /dev/null
rm $SAVE_DIR/$ligne.sql
done < listdb
rm listdb
echo date +"%y-%m-%d %H:%M:%S"
“Backup ended” >> $LOG_FILE
[/code]