#!/bin/bash
#The scripts is Writen for backup mysql User xusj data.
#Script name mysqlback.sh
backupdir=/data/backup
time=`date +%Y-%m-%d_%H_%M_%S`
dbname=xusj
dbpasswd=xusj01
/data/mysql/bin/mysqldump -u$dbname -p$dbpasswd $dbname | gzip > $backupdir/$dbname$time.sql.gz
find $backupdir -name $dbname"*.sql.gz" -type f -mtime +5 -exec rm -rf {} \; > /dev/null 2>&1
本文出自 “少犟” 博客,请务必保留此出处http://xushaojie.blog.51cto.com/6205370/1719956
原文地址:http://xushaojie.blog.51cto.com/6205370/1719956