I know its easy enough to back up databases, its more of a chore than anything to ensure its done regulally. Are there any applications out there that can be installed to do it automatically at pre set intervals?
I would like to know if there is one that can do it automatically also. I belive it can be done through cronjobs but not sure
What sort of databases? I wrote a small script in bash to backup each database on our mysql database server and it is ran as a cron every 4 hours. I'm unsure if it's completely efficient but it does the job just fine for me. The script also then deletes backups older than 28 days.. they are sorted by /rootbackupdir/databasename/backup_time.sql.gz Code (text): #!/bin/bash username="mysql_root_user_or_user_with_access" password="mysql_password" for i in `echo "show databases" | mysql -u$username -p$password|grep -v Database`; do filestamp=$(date '+%d')-$(date '+%m')-$(date '+%y')_$(date '+%H'):$(date '+%M'):$(date '+%S') rootdir=/backup dir=$rootdir/$i file=$dir/$filestamp.sql.gz echo Starting backup for $i as $filestamp if ! [ -d $dir ]; then echo -- Directory does not exist, creating it at $dir mkdir $dir fi mysqldump -u$username -p$password $i | gzip -9 > $file chmod go-xrw $file echo -- File stored at $file done echo Deleting backup files created or changed over 28 days ago find $rootdir -type f -ctime +28 -exec rm -rf {} \; echo Done! Now now, doing this isn't too great if you have absolutely huge databases being accessed very rapidly I don't think... in that case you have to look at other setups, such as (if you have one) having the backups made on the slave server. The slave mysql server is stopped [well, just replication from the master], backups are then taken from there and stored, then the slave replication starts again and it catches up with the master. This then causes no disruption to applications using the mysql server and prevents corrupt backups. In the simplest form, you can use mysqldump to backup mysql databases on a cron to a file containing the timestamp at that point.. then have another cron removing old files. In our case, we just use the above script every 4 hours on a cron and then every 12 hours the backup directory is rsyncd with remote backup space in another datacenter (in another country, far away!). As our database server gets busier, we may move the load around to other servers or we may setup slaves - where backups can be taken from without corruption.
Incase anybody is wondering, just place that script into a file. Then enter the mysql username/password with access to the databases which need backing up. Make sure /backup exists (or you can change the directory in the script) and is writeable by the user you intend to run the script.. then set the script so that it can be executed (chmod +x script_name.sh). You can then run the file as a cron, do a test run first in your console though.. I'm unsure if it will work properly for you, it was just quickly setup to get our backups running when we first moved into our current setup.. it works just great here though