====== InnoBackupX ====== * This is great tool for hot online backup.\\ * Following script is used to backup mysql to remote server with key less entry only.\\ * Following script need you to change some variables.\\ == Master server == #!/bin/bash if /usr/bin/innobackupex-1.5.1 --no-timestamp --no-lock --user=root --password=testpassword --stream=tar ./ | ssh root@remote.backup.com "cat - > /root/bkuptest/Backup/test.tar" then if ssh root@remote.backup.com "/usr/bin/mybackup.sh" then echo "Backup Done" | mail -s "[Backup] backup done Complete" ketan@email.com else echo "Backup Failed" | mail -s "[Backup] master Failed" ketan@email.com fi else echo "Backup Failed" | mail -s "[Backup] master Failed" ketan@email.com fi == Remote Server == #!/bin/bash cd /root/bkuptest/Backup if tar -ixvf test.tar then /etc/init.d/mysqld stop /bin/sleep 20 if ps awux | grep -v grep | grep mysqld then exit $? else echo "mysql stopped" fi if rm -rf /var/lib/mysql/* then echo "remove done" if /usr/bin/innobackupex-1.5.1 --copy-back /root/bkuptest/Backup/ then echo "copy back done" if chown -R mysql:mysql /var/lib/mysql then echo "permission Done" /bin/sleep 20 /etc/init.d/mysqld start /bin/sleep 20 if ps awux | grep -v grep | grep mysqld then echo "mysql started" else exit $? fi if /usr/bin/innobackupex-1.5.1 --apply-log --user=root --password=testpassword /root/bkuptest/Backup/ then echo "applying log done" if rm -rf /root/bkuptest/Backup/* then echo "removing done" exit $? else echo "failed removing backup" | mail -s "[Backup] remote.backup.com Failed Backup " ketan@email.com exit $? fi else echo "Failed applying log" | mail -s "[Backup] remote.backup.com Failed Backup " ketan@email.com exit $? fi else echo "Failed setting up permission" | mail -s "[Backup] remote.backup.com Failed Backup " ketan@email.com exit $? fi else echo "Filed on Copy Back" | mail -s "[Backup] remote.backup.com Failed Backup " ketan@email.com exit $? fi else echo "Failed Removing Mysql Files" | mail -s "[Backup] remote.backup.com Failed Backup " ketan@email.com exit $? fi fi else echo "Failed everything on destination" | mail -s "[Backup] remote.backup.com Failed Backup " ketan@email.com fi