The following commands can be added via crontab.  As-is, they will dump all MySQL databases to a GZIPped batch file every 2 hours and delete old dumps after 10 days.

Substitute the correct values for USER (usually "root") and PASSWORD and LOCATION.

0 0,2,4,6,8,10,12,14,16,18,20,22 * * * mysqldump -uUSER -pPASSWORD -A | gzip > /LOCATION/$(date +\%Y_\%m_\%d-\%T).sql.gz
0 1 * * *  find /LOCATION -name "*.gz" -mtime +10 -delete
  • 0 Users Found This Useful

Was this answer helpful?

Related Articles

Recursively delete old files in Windows

The following command will recursively delete files older than X number of days: forfiles -p...

FileZilla FTP server recommended settings

Edit -> Settings*Note: settings not explictly mentioned can generally be left as defaults...

Import MS SQL T-SQL script

A MS SQL T-SQL script can be imported via the following command-line: sqlcmd -U db_user -P...

Windows 2003 IIS will not start

Problem: IIS is stopped and trying to start it returns an "IIS admin service not started"...

MVC3 and Medium Trust

If you run .NET in Medium Trust and receive an error like this when installing MVC 3: Error...