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 [2020/08/10 02:35]
xtrabackup_script [2020/08/10 02:35] (current)
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: 2020/08/10 02:35 (external edit)