XtraBackup

Nice tool to create Hot Backup.
Project Page

#!/bin/bash
 
today=`date +%Y%m%d`
yesterday=`date -d 'now -2 days' +%Y%m%d`
 
if [ ! -d /usr/new_db_backup/$today ]; then
 
        if /usr/bin/innobackupex-1.5.1 --defaults-file=/etc/my.cnf --tmpdir=/tmp --user=root --password=TestDrive --no-timestamp  /usr/new_db_backup/$today
        then
                echo "Backup completed Successfully Location /usr/new_db_backup/$today" | mail -s "[BACKUPS] `hostname` " ketan@email.com
                /bin/rm -rf /usr/new_db_backup/$yesterday
                exit 0
        else
                echo "The xtrabackup did not complete successfully." | mail -s "[BACKUPS] `hostname` " ketan@email.com
                exit 1
        fi
else
        echo "Directory exists might be second run please check" | mail -s "[BACKUPS] `hostname` " ketan@email.com
        exit 1
fi