New camera bag
As you may have read in my previous post, I enjoyed a wonderful weekend as a photojournalist. Doing so, I learned the limits of my kit, especially my cheap long lens. A second inadequacy was in my camera bag; iPads are now a necessary part of any roving photographer’s equipment and regular bags just don’t have the space for the additional iPad kit. As you can see, there’s not much room in a traditional camera bag for an iPad and a DSLR with a 250mm lens meaning two bags or spare lenses in your pockets. And just imagine what happens if it rains.
read more…My weekend as a journalist
UPDATE: Picture of me on TV at the bottom of this post.
There are some things that, when offered, you have to say yes to. You know them when you see them and you know them when you think “how much would I regret it if I didn’t do this?” I had one of those opportunities last weekend. I was asked to go and cover the World Superbikes race at Silverstone for MotoRaceReports, a blog I write for. I would get a full media pass and all I’d have to do was write a report, tweet about it and take some photos. Hell, yes.
Now, I’ve taken photos at Silverstone before and I’ve had paddock access, so this would be the same sort of deal, right? read more…
An Apache Watchgoose
In the past, people have used geese in the place of watchdogs because they honk and flap rather a lot. Usually, the domestic Greylag Goose is the preferred choice as it’s half a kilo heavier than the Swan Goose. It was also a goose that God chose to infuse with his divine will in 1096 as part of the People’s Crusade, according to the Germans that followed him around the Rhine region, killing any Jews they found. Those pesky Germans, eh?
So, with that in mind, when I found myself looking for a watchdog script to monitor and fix Apache and nothing fitted my needs exactly, I decided to infuse my script with the power and will of the goose. I don’t know if this will be of use to anyone, but my previous script was well received by one or two people so here you go.
#!/bin/bash
#
# watchgoose.sh - an Apache restartinator.
# Put it in your crontab every five minutes
#
export site="http://cat5.org/" # replace with a site running on your webserver
export tempfile=~jearle/bin/goose.txt # This can be anywhere
export logfile=~jearle/bin/goose.log # Logfile
export email=jearle@example.com # Your email address
if [ "`curl -sIm 5 ${site} | head -1 | tr -d '\r'`" != "HTTP/1.1 200 OK" ]; then
echo `date +%F\ %T` > $tempfile
/usr/bin/top -b -n1 >> $tempfile
ps wwaux | awk '/httpd/{print "kill -9 " $2}' | sh
/usr/sbin/apachectl graceful >> $tempfile
echo "Attempted Apache restart at `date +%F\ %T`" >> $tempfile
echo "Attempted Apache restart at `date +%F\ %T`" >> $logfile
cat ${tempfile} | /bin/mail $email -s "[CAT5] Restarted Apache"
rm ${tempfile}
fi
echo "`date +%F\ %T` and all is well ..." >> $logfile
Apologies to those who came here to see how the native Americans used waterfowl to guard their teepees. This isn’t the post you’re looking for. Honk, honk! Oh, and if you’re looking for someone to cripple your goose, try Pet Connection NI instead.
Recently, I had the good fortune to be invited by some friends to help them out at E3 in LA. As an inhabitant of Scotland, this would inevitably entail a plane ride across the Atlantic ocean, and this gave me an idea. I would try to get from the UK to LA with an absolute minimum of paperwork. Just my passport, iPhone 3GS and iPad 3G. How hard could it be?
Plesk MySQL backup script
This may not be worthy of a blog post, but people have asked for my MySQL backup script as used on the Plesk servers I manage, so here it is. It’s short and sweet and is installed by running from crontab. It shows my propensity to use awk to write scripts that are then piped through sh to be executed.
#!/bin/bash
# Jared Earle, 2008-03-28, BD-NTWK
# Set the datestamp, login credentials and backup directory
export date=$(date +\%Y\%m\%d)
export creds="-uadmin -p`sudo cat /etc/psa/.psa.shadow`"
export backupdir="/home/jearle/backup"
# delete week old files
find ${backupdir}/ -regex '.*.dump.gz' -mtime +4 -exec rm {} \;
# dump databases to the backupdir
echo "show databases;" | mysql ${creds} | egrep -v ^Database$ | \
awk '{print "mysqldump ${creds} "$1" | \
gzip > ${backupdir}/db-"$1"-${date}.dump.gz"}' | \
sh
Oh, don’t forget to make sure that $backupdir isn’t readable by everyone. Yeah, obvious, I know.






