Auto backup of www and mysql
Hey there team :D
I'm working on a project with me and a friend... I currently run apache & mysql I would like to setup a cron to automatically backup the database and several directories on the server? Can anyone show me an example of the cron script I need? Thanks :D |
it depends how you want to backup
the easiest way would be something like : (using cp there) 15 4 * * 6 root cp -a /where/your/www/folder/is /mnt/where/to/backup |
15 4 * * 6 root cp -a /where/your/www/folder/is /mnt/where/to/backup
What exactly will that do? every 15 minutes? it will copy the website into that directory?... what does the 4 * * 6 mean? also do I just run crontab -e ? and add that there?.. also do you have any idea how to backup the mysql database? :scratch: |
I've got this so far
30 0 * * * DATE=$(date +%Y%m%d%M%H) && mkdir /var/backup/drumandbass/public_html/$DATE/ && cp -a /home/drumandbass/public_html /var/backup/drumandbass/public_html/$DATE/ Look okay? |
woohoo I just became a member :D
|
Quote:
It could be a good idea to use "tar" instead however, as it will take less space. You could replace the cp part with something like : "tar -cpsjf /mnt/backup/www.tar.bz2 /where/to/www" (this tar and bunzip, so it will be compressed). To backup the MYSQL database, just do the same about the MYSQL directory (something like /usr/lib/var/mysql I believe?). Quote:
|
This wasn't working for me for ages...
This is what i ended up doing... made a simple backup script using SH made cron call the script and let the script do the work Poblem solved ;) |
All times are GMT -5. The time now is 03:43 PM. |