Linux – Daily Weekly and Monthly DB backup with logrotate

backuplinuxlogrotateMySQL

I am currently keeping daily backup of my database by doing a daily mysqldump and by using logrotate to keep the 7 last days of mysqldump.

I would like to improve this backup process to keep 7 daily backup, 3 weekly backups and 12 monthly backup.

I found this article which explain how to di this with logrotate : https://web.archive.org/web/20070625054821/http://hotcoding.com/os/sysadmin/35751.html

However I am using the dateext logrotate option to name my backup files so I cannot use this solution.

How can I do daily, weekly and monthly backup with logrotate and with the dateext option?

Best Answer

Check out the script AutoMySQLBackup https://sourceforge.net/projects/automysqlbackup/

This is a great script to backup one/all databases, using mysqldump (assuming these are mysql databases)