This script is an extension of automysqlbackup, to support hourly backups of MySQL databases.
Debian and Ubuntu only. Tested with Debian 10 (Buster) and Ubuntu 20.04 (Focal).
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.
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.