Mysql备份脚本

#!/bin/bash
###backup mysql data

###Writen by wuqunshan
mysql_user=”用户名”
mysql_pass=”密码”
dump_path=”/backup/mysql-backup”
date=”`date +%F`”

if [ ! -d $dump_path ]; then
mkdir -p $dump_path
fi

/usr/local/mysql/bin/mysqldump -u$mysql_user -p$mysql_pass weblog > $dump_path/$date.weblog1.sql 2> /dev/null
find $dump_path/ -mtime +30 |xargs rm -rf

发表评论