====== MySQL-Backup ====== Exportiert die angegebenen Datenbanken und verschickt diese an die angegebene Adresse. #!/bin/bash # Backup+mail your Databases hostname=`hostname` dump=Backupdatei.sql arch=Backupdatei.sql.bz2 email=YOU@YOURDOMAIN.COM # dump databases, asks for password if not set in .my.cnf # see http://dev.mysql.com/doc/refman/5.0/en/password-security.html mysqldump --all-databases -u root > $dump # only some Databases: # mysqldump -B yourDB1 yourDB2 yourDB3 -u root > $dump # compress (bz2) tar cjf $arch $dump # mail it echo "MySQL-Backup von $hostname" | mutt -a $arch -s "MySQL-Backup $hostname" $email # delete files rm $dump rm $arch