/automysqlbackup_hourly

A short extension for automysqlbackup, allowing to perform hourly backups.

Primary LanguageShellMIT LicenseMIT

automysqlbackup_hourly

This script is an extension of automysqlbackup, to support hourly backups of MySQL databases.

Compatibility

Debian and Ubuntu only. Tested on production servers with Debian 8 (Jessie) and Ubuntu 14.04.

Installation

First, automysqlbackup must be installed :

sudo apt-get install automysqlbackup

The automysqlbackup_hourly script can be copied or linked into /etc/cron.hourly/ :

sudo ln -s automysqlbackup_hourly /etc/cron.hourly/

For testing it, just launch as root :

./automysqlbackup_hourly

Then, in your backup's directory, you will see :

hourly daily weekly monthly

Every hour, you'll have a new dump for each database in hourly directory.

How it works

Every hour, it takes the last dump present in your daily or weekly directory (depending on the day given by DOWEEKLY parameter), and copy it to the hourly/yourdb directory. Then, it launches the automysqlbackup script to create a new dump in daily or weekly directory. Finally, dumps older than 7 days in hourly directory are deleted. You can change the number of days by changing ROTATION_DAYS variable, at the beginning of the script.