Created
January 12, 2017 06:51
-
-
Save balos1/07ca2126946ac6c44ebe4ffddcfc85d4 to your computer and use it in GitHub Desktop.
Script to backup MySQL database. Can be used with cron for automatic backups.
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/sh | |
DAY=`/bin/date +%Y%m%d` | |
PAST_DAY=`/bin/date -d '5 days ago' +%Y%m%d` | |
mysqldump DATABASE -u root -pPASSWORD > /path/to/it/DATABASE.$DAY.sql | |
rm -f /path/to/it/DATABASE.$PAST_DAY.sql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment