So now that I have all of the systems setup and running for my websites, I needed a way to back up the data on a regular basis. There are of course many backup applications that you could use but I wanted something easy and cheap. I hunted around the internet for a bash backup script and came across a few. I have taken a few of the items used in each of them and built this script.

The script backups the databases into a directory that is labeled with the date. It will also clean up backups older then the retention period. It also needed to automatically backup new databases that may appear from time to time unless specifically stated.

So here is the script

Update the variables at the top of the script and save it into your home directory or somewhere similar, I run the script at 5 minutes past 1am each morning to try and get a quite time.

Next I want to be able to automate the ability to send the backups offsite aswell. So I will update the script in the future to do this.