x
Loading
 Loading
Hello, Guest | Login | Register

Smoke and Mirrors

The other day, I was looking at rsync to set up the publishing of my Web site from a CVS-managed archive. I thought it would be simple to use rsync in “archive” mode to accurately mirror a staging directory. But I just couldn’t get the hooks right. I also wanted to ignore specific differences and add mail notification for when certain pages were updated.

The other day, I was looking at rsync to set up the publishing of my Web site from a CVS-managed archive. I thought it would be simple to use rsync in “archive” mode to accurately mirror a staging directory. But I just couldn’t get the hooks right. I also wanted to ignore specific differences and add mail notification for when certain pages were updated.

So I hunted around for an rsync-like tool in Perl that I could modify to fit my needs. I figured it couldn’t be very hard and that someone must have already invented that particular wheel. I looked first in the Perl Power Tools project (http://language.perl.com/ppt/), but alas, it was not there. Even searching the Net didn’t help. So I did the next best thing — I wrote one from scratch.

I thought it would be short, but by the time I had something decent, I ended up with Listing One. Now, a very important warning before I go on: this is a work-in-progress version. I’ve not put a lot of time into it, although I will in the future. If you use this version, and you lose data, don’t sue me. Also, since it’s pretty long, I’ll just hit the high points in the listing, where the cool stuff actually lives.

Listing One: Custom rsync

 1 #!/usr/bin/perl -w 2 use strict;…

Please log in to view this content.

Not Yet a Member?

Register with LinuxMagazine.com and get free access to the entire archive, including:

  • Hands-on Content
  • White Papers
  • Community Features
  • And more.
Already a Member?
Log in!
Username

Password

Remember me

Forgotten your password?
Forgotten your username?
Read More
  1. Helpful Tools for Software Developers
  2. The Github Hall of Fame
  3. Book'em, Github.
  4. This Week on Github: Stupid Ruby Tricks
  5. A Veritable Scatter Shot!
Follow Linux Magazine
Rackspace