I build custom sites (PHP & MySQL), and I have terrible backup habits. I really need an automated way to backup all of the site files, and all of the database information to multiple locations. As of right now, I haven't found a way to do this that I have been happy with. I'm completely open to purchasing software to accomplish this if I have to. How does everyone handle full site backups? Features I would like: -I want dated backups of both the files and the database. It would be nice to have them all wrapped up in to some sort of archive (.zip, .7z. .rar, whatever) -I want it to backup to my work computer, and an offsite backup location. -I want it to be automated, and I want to be able to select the frequency for various different sites.
cron+script (unix) - under windows can be done the same - code like following: #!/bin/sh files=/var/tmp/files database=databasename dbuser=username dbpasswd=dbpwd remoteuser=remoteusername remotepasswd=remotepassword remoteplace=/backups hostid=host13 cd /var/tmp mkdir backup cp -R $files ./backup mysqldump -u $dbuser $database -p$dbpasswd > ./backup/db.sql arcname=$hostid`date +%s`.tar tar -cf $hostid`date +%s`.tar backup rm -Rf backup bzip2 $hostid`date +%s`.tar scp $hostid`date +%s`.tar.bz2 $remoteuser:$remotepassword@$remotehost:$remoteplace rm -f $hostid`date +%s`.tar.bz2 Code (markup):
I usually end up using hosting plans that have CPanel on them. Most of the time I find CPanel's backup features most unhelpful. Vasyl, could you explain your code a bit? I'm not that familiar with Unix commands. Do I run this on the server, or on my local machine? It looks like this is something that I run on the server. If that is the case, I don't think it will be a possibility for me because I usually use shared hosting plans. Please correct me if I'm wrong.
Shared hosting plan usually means a kind of control panel that have some backup functions. The solution draft provided is for dedicated/VPS...
Thanks vasyl. I really do need to get a dedicated server or a VPS sometime, I'm just not there yet. How do most people make daily backups in a shared environment? I know how to use the backup utility in the admin area, but there has got to be a better way. I'm guessing some software that makes an FTP call to the site and pulls down all of the files or something.
If you are provided with a cpanel by the host, you have the facility you wanted, like creating a backup and then downloading the same to your local machine. but i dont think there is any automated or timely mechanism where the backup would be send every hour to your mail or some other similar fascility over there.