Last active
September 26, 2016 11:36
-
-
Save veryyoung/0ea4ab5fe34476163e4f477ce830749c to your computer and use it in GitHub Desktop.
定时备份数据
This file contains hidden or 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
| #! /bin/Bash | |
| # config in crontab 30 23 | |
| # 30 23 * * * sh /root/backup/backup.sh>>/root/backup/backup.log | |
| DB_USER='root' | |
| DB_PASSWORD='' | |
| DB_NAME='test' | |
| BACKDIR='/root/backup' | |
| currentDate=`date +%F` | |
| echo $currentDate | |
| /usr/bin/mysqldump --user=${DB_USER} --password=${DB_PASSWORD} ${DB_NAME}>${BACKDIR}/${DB_NAME}_${currentDate}.sql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment