This would be one feature that would be a excellent addition to the core package, as loosing the database has some fairly major consequences to the running of threads...
I spent some time reading the MySQL manual to figure out how to do backups, and came up with a few issues which may affect your script. If you're a MySQL guru, perhaps you could look at my post and give me your opinion.
your idea is good, but there is a real problem I think. You are gonna dump the WHOLE database at one time. This could crash if a) the isp has memory restrictions for scripts b) the isp has time restrictions for script
My table w3t_Posts has 30MB and every time I wanna backup with such a funktion the script dies with an error like "Mysqldump rans out of memory"
So I wrote a recursivly script to do the work and one which do the work for at least one table.
I´ve to make some changes to it and the I share the scripts this weekend.
2) You could optimize the loops slightly by removing processing that doesn't need to be done on every loop iteration, but I doubt if it really matters here, since there are only 17 tables.
It creates SEVERAL backups, because often there is a corruption and it already is in 1-2 backups before I discover it. I back up every 12 hours
[root@a3p mario]# crontab -l # DO NOT EDIT THIS FILE - edit the master and reinstall. # (/tmp/crontab.7136 installed on Sun Jul 7 09:50:34 2002) # (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $) 28 */12 * * * /root/cron/cron_mysqlbackup
[root@a3p mario]#
If you have passwords, of course, add the passwords Note the NICE!!
Question: what happens to writes during backup? mysql can back up for half an hour during writes? If it blocks the database, I might as well remove the nice..
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.