Created
January 4, 2018 04:27
-
-
Save sicksand/62c05b26cd090b97d61ed4824c99159b to your computer and use it in GitHub Desktop.
Cron job backup mysql database everyday and delete file after 7 days
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
#backup retention only 7 days | |
0 1 * * * find /home/sicksand/backup -mtime +7 -type f -delete | |
#backup | |
0 5 * * * mysqldump -u empdb -empdbpassword --single-transaction empdb | gzip -9 > /home/sicksand/backup/empdb_`date +\%Y\%m\%d_\%H\%M\%S`.sql.gz |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment