tags:

views:

32

answers:

4

I have a backup created of my mysql database (vbulletin forum v3.8) everyday. It's about 360mb in size. It's stored as one text file in a secure folder.

I'm thinking of getting another server, through a different host, and somehow automatically transferring the backup to my second server every day.

Any ideas on how I could automate this process? I'm thinking PHP and a cron job.

+3  A: 

Cron definately. Php, if you like it, but using bash with mysqldump combined with gzip works wonders.

Martin Wickman
Should I set the script up on the downloading server, or on the uploading server? Also, how do I keep cron going? Seems if I'm moving 360mb, it will time out before its done. THNX
codemonkey613
Cron is a daemon (`crond`) which runs certain commands at certain times. It runs the command by forking and the command itself can run for as long as it like. So no problem there. If you are uploading with FTP then you should run the script on the uploading server. (I would suggest using `scp` instead of ftp though).
Martin Wickman
A: 

Schedule rsync to transfer the files (over ssh) with cron (if you're on Linux).

ChristopheD
A: 

Cron + rsync may be your best bet. If the file is text as you say and the changes are "diff"able then rsync can be used to transfer only the updates to that file. For example, the crontab could look something like this:

20 4 * * * rsync -a --delete source/ [email protected]:/path/to/destination/

This will sync the remote machine once a day deleting any files in the remote copy that no longer exist on the source machine.

As a note, I just read again and noticed this is a mysql backup so they output of the dump could eventually contain binary and in that case you probably want to just use a replication server or copy the file whole each day. rsync could be used for the copy as well...

A: 

slightly different approach and technically not a backup solution, but might want to consider running mysql in a replication mode and replicating changes live. so if the worst happpens you will be up to date with the data and not a day behind.

pulegium
Na, that would require a decent second server. My forum is of too little importance to fund that sort of activity. I figure I'll pay $2/mon for a shared host, and all that I require of the host is for it to be online once a day so it can pull the download. lol This means the host doesn't have to have a good uptime, or performance, keeping costs low for me.
codemonkey613