Automated website backup

Soldato
Joined
11 Oct 2004
Posts
14,549
Location
London
At the moment, I've got a blog running WordPress 2.0 on my website. I've set WordPress up to e-mail me a back-up of the mySQL database every day. This then goes to my gmail e-mail account where it's archived. It works well so I'm wondering about how to backup the other files used in my blog via an automated process to a local drive.

What do people recommend? Is there a simple way to schedule an ftp download under Windows? Would compressing and e-mailing an entire website (100-200MB) using a cron job be feasible? Is there any software out there that makes scheduled backups easy?

Cheers!
 
Associate
Joined
30 Dec 2005
Posts
415
Possibly set up a connection with another computer...say yours at home, and every night, if your computer is on, do the backup via FTP or a similar protocol. If your computer isn't on, send it via email.
 
Soldato
OP
Joined
11 Oct 2004
Posts
14,549
Location
London
Possibly set up a connection with another computer...say yours at home, and every night, if your computer is on, do the backup via FTP or a similar protocol. If your computer isn't on, send it via email.

Is there software that will automate this for me? Something that will sit in the system tray of my home machine perhaps?
 
Soldato
OP
Joined
11 Oct 2004
Posts
14,549
Location
London
I don't think that my access is full, but I've got enough access to set-up cron jobs and use various server-side software over ssh. The server is running Linux.
 
Associate
Joined
30 Dec 2005
Posts
415
There are backup tools out there on the internet for backing up Linux to Windows...but you wouldn't be able to use that because your host wouldn't let you install it.

However, you can set it up using PHP...look up on google how php can open an FTP session and transfer files...then you could use a cron job to schedule this every night.
 
Associate
Joined
30 Dec 2005
Posts
415
Straight off the PHP site.
PHP:
<?php
// set up basic connection
$conn_id = ftp_connect($ftp_server);

// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);

// check connection
if ((!$conn_id) || (!$login_result)) {
       echo "FTP connection has failed!";
       echo "Attempted to connect to $ftp_server for user $ftp_user_name";
       exit;
   } else {
       echo "Connected to $ftp_server, for user $ftp_user_name";
   }

// upload the file
$upload = ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY);

// check upload status
if (!$upload) {
       echo "FTP upload has failed!";
   } else {
       echo "Uploaded $source_file to $ftp_server as $destination_file";
   }

// close the FTP stream
ftp_close($conn_id);
?>
 
Back
Top Bottom