User Tools

Site Tools


xtrabackup_script

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

xtrabackup_script [2010/08/25 23:12] (current)
k2patel created
Line 1: Line 1:
 +====== XtraBackup ======
  
 +Nice tool to create Hot Backup.\\
 +[[https://​launchpad.net/​percona-xtrabackup | Project Page]]
 +
 +<code bash>
 +#!/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
 +</​code>​
xtrabackup_script.txt ยท Last modified: 2010/08/25 23:12 by k2patel