ToutSurTout.biz
Backup par mail


Code :

## INFOS MYSQL ## LOGIN=root # Login for mysql PASS=toto # Pass for mysql ## Email ## ADMINMAIL=user@fqdn.com # This is the mail were the saves will be send ## Vars ## TMPDIR=/tmp/baksql # Temp directory ## DO NOT MODIFY NOW ## mkdir $TMPDIR # Backuping databases for databases in "cacti" "information_schema" "mysql" "snort" "wikidb" ; do mysqldump -u$LOGIN -p$PASS $databases > $TMPDIR/$databases-'date +%y%m%d'.sql && baksql=$baksql'echo "Sauvegarde de la base $databases - OK ; "' || baksql=$baksql'echo "Sauvegarde de la base $databases - FAILED ; "' done # Compressing and emailing tar -czf $TMPDIR/mysql_backup.tgz $TMPDIR/*.sql && echo "'echo $baksql'" | mutt -x -a $TMPDIR/mysql_backup.tgz -s "MySQL backup - 'date +%d\-%m\-%Y' - fire" $ADMINMAIL rm -Rf $TMPDIR