MySQL数据备份脚本

时间:2014-05-14 17:28:34   收藏:0   阅读:333

#!/bin/bash

#MySQL备份


dates=`date +%Y%m%d`

datey=`date -d"30 days ago" +%Y%m%d`

mkdir -p /home/backup


cd /home/backup

mysqldump -uroot -pwyqj_root fight_cancer > fight_cancer.$dates.sql

mysqldump -uroot -pwyqj_root redmine > redmine.$dates.sql


mkdir -p /home/backup/fight_cancer

mkdir -p /home/backup/redmine


gzip fight_cancer.$dates.sql

gzip redmine.$dates.sql


mv fight_cancer.$dates.sql.gz /home/backup/fight_cancer

mv redmine.$dates.sql.gz /home/backup/redmine


rm -rf /home/backup/fight_cancer/fight_cancer.$datey.sql.gz

rm -rf /home/backup/redmine/redmine.$datey.sql.gz


MySQL数据备份脚本,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!