Created
August 21, 2018 07:40
-
-
Save feng88724/280f78a9b7d869478cee90e26f08684a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
backupdir=/home/mysql_backup | |
time=` date +%Y_%m_%d_%H_%M_%S ` | |
db_host=xx.xx.xx.xx|localhost | |
db_user=xxx | |
db_pass=xxx | |
db_name=xxx | |
mysqldump -h $db_host -u $db_user -p$db_pass $db_name | gzip > $backupdir/$time.sql.gz | |
find $backupdir -name "*.sql.gz" -type f -mtime +5 -exec rm -rf {} \; > /dev/null 2>&1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment