One of those weekends.. and other stuff!

It was one of those weekends for a lot of Irish people I think. Certainly, I was completely out of the loop news wise! I didn’t even know Ronald Reagan had died until I read Mark’s blog yesterday morning! Via Kevin, some don’t have anything good to say about him, and I’ve certainly heard a lot of negatives about him.

I can’t help but remember the British comedy, Spitting Image and their puppets and Ronnie trying to decide, “what’ll I have for breakfast?” mistaking the American nuclear missile launch codes for his breakfast menu.. heh.
RIP.

Wouldn’t you know it? On the day that Venus transits the Sun, others capture remarkable photos but it’s overcast here in Cork!
Hmm, and via Pixelbeat (who’s obviously a Window Maker fan!) comes this article on the Witty Worm. It’s kinda cool, as it fits inside one UDP packet!
Remember I did some tuning of our server at work? Well, traffic has returned to normal again, but I was told this is a quiet time in the futures market right now. As an exercise I deleted the php Accelerator cached files again and I am seeing another big jump in requests served! It might pay to remove those files on a daily basis!
I hope No-Action Jackson works in Wine! Looks kinda cute!
And if you want to download the trailer to Fahrenheit 9/11 (that guy in the last photo doesn’t look very “secret” to me does he?) you could try the following:

mencoder -o f911.wmv -oac copy -ovc copy mms://wm.mindshare.na-central.speedera.net/wm.mindshare.\
na-central/moore/fahrenheit_911_480.wmv

You need mplayer installed, but that’s as easy as apt-get install mplayer 🙂

Excellent! Another issue of The Digital Journalist is out. They promise a tribute to Ronald Reagan next month, that should be good, judging by their previous efforts. Just after browsing their TOC and looks like they have a few articles on D-Day.
I watched the BBC coverage of the commemeration on Sunday night and it was really well done. I even saw Brother Columbanus, an Irishman, dressed in his monk’s garb, salute and smile at the Queen as he marched past the viewing stand! (He was mentioned in an article in the Sunday Times, he took part in D-Day, and after the war returned to Ireland and became a brother in a monastory!)

Spiders, spiders.. everywhere!

Sitting down to read the Sunday Times yesterday what crawls out from underneath the paper? *shudder* Any sane person would get something to either trap or kill the spider but I grabbed my camera and snapped a few photos!
FWIW, when I was finished I trapped the spider and released it into the garden. It’s bad luck to kill a spider isn’t it?

CorkGigs.com – one to check daily!

Maybe I should make this a family blog, Donal again comes up with the goods! He told me ages ago about CorkGigs.com but I always forgot to blog it. It’s an, “events listing for live music concerts and other performances in Cork”, although I don’t see the King of Hearts there anywhere. Owen, perhaps you’d like to change that?
Anyhow, that link’s going in my links section!
If you’re in the Cork area, you might like to know about the Listeners’ Choice Festival on Campus radio, starting on the 15th. Hmm, anyone know if Campus Radio can be picked up in Blarney?

Easy Automated Snapshot-Style Backups with Rsync

Have rsync, have RAID volume, have ssh connection to server. What’s the best way to back it up? Here’s one way. Use hard links to make “duplicate” archives of remote content with the minimum of wasted space.
I’ve adapted the idea with the following:

for t in `ls remote/`
do
    for i in `ls remote/$t/`
    do
        export older=7
        rm -fr remote/$t/$i/7
        for n in `seq 6 1`
        do
            if [ ! -d remote/$t/$i/$n ]; then
                mkdir -vp remote/$t/$i/$n
            fi
            mv remote/$t/$i/$n remote/$t/$i/$older
            export older=$n
        done
        cp -al remote/$t/$i/0/. remote/$t/$i/1
    done
done

rsync -v -v --progress -az --delete --exclude-from=exclude.txt -e 'ssh' www.example.com:/home/ remote/www/home/0/
rsync -v -v --progress -az --delete --exclude '*logs/*' -e 'ssh' www.example.com:/usr/local/apache/ remote/www/apache/0/
rsync -v -v --progress -az --delete --exclude-from=exclude.txt -e 'ssh' mail.example.com:/home/ remote/mail/home/0/

Using this script you can have multiple hosts (here we have www.example.com and mail.example.com) and multiple directories(/home and /usr/local/apache) on each host backed up.
This script and post will be updated as I refine the backup procedure.
Later… After reading through the linked article above, I see that the author uses a slightly different way of rotating the archive snapshots. Instead of re-using the oldest one, he creates a hard link copy of the latest snapshot, “0”, in the “1” snapshot. When rsync downloads changed files it “deletes before copying” so that the old file is preserved in “1”, but the new file is now in “0”. Read the “hard links” section of the above for more on how that works!
Here’s a diff of what I changed:

7,12c7,8
<         if [ ! -d remote/$t/$i/7 ]; then
<             mkdir -vp remote/$t/$i/7
<         fi
<     
<         mv remote/$t/$i/7 remote/$t/$i/7.tmp
<         for n in `seq 6 0`
---
>         rm -fr remote/$t/$i/7
>         for n in `seq 6 1`
20,21c16
<         mv remote/$t/$i/7.tmp remote/$t/$i/0
<         cp -al remote/$t/$i/1/. remote/$t/$i/0
---
>         cp -al remote/$t/$i/0/. remote/$t/$i/1

Later Still… I found and installed Backuppc via delicious this morning and I’ve got it working. It uses the same idea of space saving hard links but also provides a web based interface to the backup and restore procedures. I think it can be automated and there are loads of other features I couldn’t possibly hope or wish to duplicate in a timely manner!
Installation is relatively well explained, even down to installing the required Perl modules from CPAN, but configuration is slightly harder. Just make sure to override the defaults in config.pl with config.pl in the $backupdir/pc/$host/config.pl file. That took som figuring out where that file was.
It’s already backed up two Windows machines and it’s working on a Linux box. Backup contents can be examined over the web and because it uses a “pool” mechanism, it can find duplicate files, even among different backups! That should save a lot of disk space and network bandwidth as time goes by!

Accelerating PHP Applications

This set of slides from a presentation earlier this month is well worth a read-over. I knew a lot of it, but there were a few surprises too. Hopefully I can report back in a few days time if it made much of an impact on the server!
Later… I’m impressed, but here’s a short summary of what I did first:

  • Stripped the Apache modules (libphp4 went from 5.6MB down to 1.5MB!)
  • Increased the default kernel buffer size as mentioned in the docs. I had already set the max higher, but didn’t know about the default value.
  • Moved php accelerator object files into seperate virtual host directories. I did the same with PHP4 session files.
  • Increased the StartServers, MinSpareServers and MaxSpareServers settings.

The result? Double the network traffic to our web server! I haven’t examined the logfiles yet but hopefully they’ll show an increase in page views!
Much Later… You’ll be happy to hear there was a corresponding increase in page view. If you run a Apache/PHP based website take heed of the tips above and in this presentation!