Skip to navigation

Does the Pembury Tavern have Augustiner Helles?

We are lucky to have the Pembury Tavern around the corner, a nice pub whose beer selection includes our favorite beer from Munich, Augustiner Helles. The only problem: The Pembury’s wholesale supplier sometimes has problems with stocking enough Augustiner, and that along with the fact that Augustiner, containing no additives, doesn’t keep longer than about two months, makes for the all-too-frequent Augustiner shortage at the Pembury.

Nicola and I have been joking for some time that there should be a shell script to check whether the Pembury currently offers Augustiner. Well, it turns out this is easily possible, since the Pembury is in fact a Linux-powered pub whose website directly and accurately reflects what’s in the cellar. Enter lynx-dump and we’re all set:

#!/bin/bash 
WEBSITE=http://www.individualpubs.co.uk/pembury/drinks.html 
AUGUSTINER=$(/usr/bin/lynx -dump $WEBSITE | /bin/grep -i augustiner) 
JEVER=$(/usr/bin/lynx -dump $WEBSITE | /bin/grep -i jever) 
ANDECHS=$(/usr/bin/lynx -dump $WEBSITE | /bin/grep -i andechs) 
if [ -n  "$AUGUSTINER" ]; then      
         echo "The PT currently serve:  
$AUGUSTINER 
$JEVER 
$ANDECHS" 
elif    [ -n "$JEVER" -o  -n "$ANDECHS" ]; then
         echo "The PT currently serve no Augustiner, but they serve: 
$JEVER 
$ANDECHS"  
else
     echo "Sorry, the PT currently serve neither Augustiner, nor Jever, nor Andechser." 
fi

As you’ll notice, this also checks for Andechser or Jever as alternative solutions to our cravings for German beer. :)

For even more geeky fun, I’ve put up a mail reply service. If you send an e-mail with the subject line “PT-augustiner-info” to my private e-mail address (my first name (at) my last name (dot) info), you should receive a reply containing the up-to-date information.

This service uses procmail and anohter shell script.

The shell script:

#!/bin/bash 
SENDER=$(formail -x "From:")
WEBSITE=http://www.individualpubs.co.uk/pembury/drinks.html
AUGUSTINER=$(/usr/bin/lynx -dump $WEBSITE | /bin/grep -i augustiner)
JEVER=$(/usr/bin/lynx -dump $WEBSITE | /bin/grep -i jever)
ANDECHS=$(/usr/bin/lynx -dump $WEBSITE | /bin/grep -i andechs) 
if [ -n  "$AUGUSTINER" ]; then
      echo "The PT currently serve  
$AUGUSTINER 
$JEVER 
$ANDECHS" | mail "$SENDER" -s "The PT serve Augustiner" 
elif    [ -n "$JEVER" -o  -n "$ANDECHS" ]; then
      echo "The PT currently serve no Augustiner, but they serve: 
$JEVER 
$ANDECHS" | mail "$SENDER" -s "The PT currently serve no Augustiner, but ..." 
else
      echo "Sorry, the PT serve neither Augustiner, nor Andechser, nor Jever
But you might check out $WEBSITE for other nice beers." | mail "$SENDER" -s "Sorry, no Augustiner, Jever, or Andechser beer at the PT" 
fi

The recipe in ~/.procmailrc:

:0
* ^Subject.*PT-augustiner-info$
| /home/mpromber/bin/augustiner

Addendum

The e-mail information service now also works if you send an e-mail to augustiner (at) mylastname (dot) info. If you’re unsure what my last name is, look at the URL of this blog :) The modified procmail recipe for this (since one can never have too many examples of procmail recipes):

:0
* (^Subject.*PT-augustiner-info$)|(^To.*augustiner@promberger.info$)
| /home/mpromber/bin/augustiner

One Response to “Does the Pembury Tavern have Augustiner Helles?”

  1. EffJot - Altes Bier, moderne Technik Says:

    […] Schelm der dabei an den Trojan Room denkt: ein Shellskript zur Fernabfrage zur Augustiner-Verfügbarkeit in der Pembury Tavern. (Nicht daß ich in nächster Zeit in der Gegend wäre, aber für den Fall […]