Skip to main content

Mysql Hotcopy Backup Script

It is very easy to get mysql hot copy backup with the following script. /mysql_backup is nfs mounted disk.


#!/bin/bash
umount /mysql_backup
mount /mysql_backup
backup_day=$(date +%A)
mysqlhotcopy -u <dbuser> –password=<dbpass>  <dbname> /mysql_backup/
tar zcfp /mysql_backup/<dbname>_$backup_day.TGZ /mysql_backup/<dbname>
rm -fr /mysql_backup/<dbname>
umount /mysql_backup

Comments

Popular posts from this blog

Find and replace with sed command in Linux

Find and replace feature is always handy. It can turn into a torture when it comes to change or delete a simple constant string in a text file. There is a handy tool in linux for doing these kind of tihngs. Actually sed is not a text editor but it is used outside of the text file to make changes.