I would like to setup a cron job for to backup all my web server files to a compressed file and also my MYSQL db. I have full acces to my server as it is a VPS. I am a noob at linux and could really use the help. I am also running centos 5. I would appreciate any help I can get. Also what is the fatsest method to do this.
3 Answers
Depending on the size of your site one if the easiest ways would be to do a database dump, create a tar.gz archive of your site directory and dump file and email it to an external location.
Look for example scripts on using tar and MySQL database dumps. The hardest part for new admins in this kind of setup is getting the email working. If you don't already have an email server set up it is probably easiest to use gmail or equivalent.
I have a couple clients that use almost this exact method. If you want more detail just ask.

- 15,545
- 10
- 75
- 115
I used to do exactly what Tim Brigham described but these days I no longer compress the dump files. Instead I use rsync to transfer the files. Because most databases only change relatively little between backups and rsync only transfers the changes the data is transferred much faster. This can be of particular benefit with largish dump files.

- 27,458
- 12
- 55
- 109
-
True.. I didn't want to get into differential backups or the need to run a second system for pushing or pulling the backups. – Tim Brigham Apr 17 '12 at 12:51