wesg header image 2

How to: Backup a website with FTPcopy

February 17th, 2010 · No Comments

When running a website, it is very important to have a backup of all site files, to prepare for any event that may require reloading data (file corruption, moving hosts, etc.). After building my Ubuntu file server, I knew that I had to find a way to mirror this website so files could be recovered if necessary.

I looked at rsync and curlftpfs, but that combination was complex to set up. Soon after, I stumbled on FTPcopy and have found a good solution.

Here is a bash script to automate the process and create a daily mirror of whatever FTP server you want to back up.

  1. Download and install FTPCopy from the repositories.
    sudo apt-get install ftpcopy
  2. Change to a directory that will store the script and open a new text file.
    cd /path/to/directory
    vi ftpbackup
  3. Press i, then copy and paste the following text.
    #!/bin/bash

    USER=username
    HOST="website"
    PASS=password
    REMOTE="public_html/"
    DIR=$(echo "/path/to/backup/$HOST")
    cd $DIR

    # Issue FTPcopy command
    ftpcopy --no-delete -l 1 -u $USER -p $PASS $HOST $REMOTE .

  4. Be sure to change the values for website, storage directory, remote directory, host, username and password.
  5. Save and exit the text file by typing :wq
  6. Make the script executable by typing chmod a+x /path/to/script
  7. Add the script to the crontab so it will be executed on a regular basis. I use Webmin for this type of administration work, but it is possible to use the command line. Use this example to sort out the format. Mine runs daily at 12 AM.

To clarify, this code changes directories into the backup folder, then issues the ftpcopy command. The remote directory of public_html is common on many webservers, but be sure to confirm before running the script. The no-delete option means that files are not removed from the backup if they’ve been removed from the web server. The l option simply means provide feedback of what files are being moved — this can be viewed in your user mail.

After the time has passed for the first time, check the folder where your backups will reside to make sure they are being added as planned.

→ No CommentsCategory: Ubuntu
Tags: , , , ,

The 13″ Unibody MacBook Pro

February 16th, 2010 · No Comments

With school demanding more from 3D graphics and design, and the lack of power in the GMA950 for Keynote work, it was time for a computer upgrade. Couple that with Applecare that ran out earlier this week, and you get a nice new 13″ Unibody MacBook Pro.
Since it’s been 2 months now since I’ve [...]

[Read more →]

→ No CommentsCategory: Gear
Tags: , , , ,

This is an Arduino

January 11th, 2010 · 1 Comment

After choosing a mechatronics option in my final year of mechanical engineering, I’ve gotten more interested in electronics and computer integration. Sure, I’ve done programming in the past (and present) but there is something very satisfying about writing code on a screen and having it perform an action in the real world. With that in [...]

[Read more →]

→ 1 CommentCategory: Arduino
Tags: , , , , ,

Experimenting with Google Chrome OS

November 21st, 2009 · No Comments

The interwebs have been on fire in the last few days with talk of Google’s new project, Chrome OS. This is a Google version of the open-source project Chromium that aims to produce an operating system less dependent on local hardware and instead stores data in the “cloud”, or internet services. This has a number [...]

[Read more →]

→ No CommentsCategory: Thoughts
Tags: , , , ,

Operating system look: Windows 7

October 26th, 2009 · No Comments

Windows 7 promises to be a vast improvement over Vista. While this is most definitely a Mac-focused blog, I think it’s a good idea to compare all the next generation operating systems together — the other two being Snow Leopard and Ubuntu 9.04.
Having installed the RC build 7100 and using it on and off [...]

[Read more →]

→ No CommentsCategory: Windows
Tags: , ,