Uncategorized

Using Rsync for Higher Quality (Error-free) Web Design

Why

It’s always best to test your machines before you send them into the wild. All my web clients have a test copy of their website on a password protected server where they can review and approve changes. Once the changes are approved I need to be sure that they all get copied to the live server. Miss a file and things could break. I need a bullet proof way to make sure it all gets sent and I’d rather not do it by copying the entire contents of the website every time I make a change.

I’m a big believer in eating your own dog food: I test all my parts before I ship them and I only recommend technologies I have used in my own work. One of the reasons I outgrew my old web host is that they wouldn’t let me run rsync, the tool I now use with my clients. Rsync will copy files from one machine to another very efficiently. It only copies the differences in the files, saving a lot of time.

How

The basic rsync syntax is very simple.

[code language=”bash”]rsync rdz /my/dev/folder [email protected]:/remote/folder[/code]

This is a bash command that tells the linux machine “use SSH to copy the entire directory of /my/dev/folder to /remote_folder/ on remote.machine.com and log in with account_name if you need to.”

Now I put this in a bash shell script and then run it whenever I need to update the store. I have a similar script for each of my clients. Hell, I might even make it into a web-console so I don’t have to edit copies of this script. We’ll see if I do it enough times that it’s worth automating.