For all Archers fans

Written by sdclee on December 20, 2011 Categories: bash, Code, Software

So I have this friend we’ll call Bill (coincidentally that is actually his name). He meddles about on a narrow boat for more time than might be healthy for him (no doubt he could say the same about my sitting in front of a screen or two for hours on end). If he stays away too long on his beloved vessel (as he often does) I get a text message asking me if I have kept the previous week’s omnibus podcast of the Archers*.

Anyway, I am often behind in my own catch-up of the omnibus and usually keep a couple of past  editions on a USB stick, so I am able to send them to him using this excellent large file transfer site. That said, there is a certain amount of manual labour involved so I decided to automate the thing with a simple crontab entry set to run at 2pm each Sunday. For fun I even added a nagios monitor plugin to make sure the episodes are up to date. The episodes just sit is an listing accessible web directory.

So here’s the simple script for any newbie to bash if you want to do something vaguely equivalent.

#!/bin/bash
cd /var/www
LOG=archersfetch.log
DATE=`date +'%Y%m%d'`
URL=http://downloads.bbc.co.uk/podcasts/radio4/archersomni/archersomni
DATENOW=`date +'%Y-%m-%d %H:%M:%S'`
echo $DATENOW " Fetching archers omnibus for " ${DATE} >> $LOG
wget ${URL}_${DATE}-1120b.mp3
mv archersomni_${DATE}-1120b.mp3 archers
ls -lrt >> $LOG
nagios monitor

Nagios watching over my Archers Omnibus Podcasts

*For those in the world who don’t know what I’m talking about take a look at the website for the longest running soap on BBC radio. The podcast is available for 7 days.

 

1 Comment on For all Archers fans

1 Comment

Leave a Reply

Your email address will not be published. Required fields are marked *