linux下 mysql备份数据库脚本并删除前7天前数据
#!/bin/bash
# Name:bakmysql.sh
#
backupdir=/data/backup/database
time=` date +%Y%m%d%H%M%S `
mysqldump -u root -p123456 h3blog | gzip > $backupdir/h3blog_$time.sql.gz
#
find $backupdir -name "h3blog_*.sql.gz" -type f -mtime +7 -exec rm {} \; > /dev/null 2>&1