#!/bin/bash

# Owlbeek.sh version 0.11 Copyright Jonas Häggqvist 2005
# Use under terms of BSD license.

# Changelog
#
# 0.11 - Removed some bashisms - you still need a real shell though
#        Changed shell to bash - change this if you need to run it on another shell
# 0.1  - Initial release

# If you want to use this as a telnet server using inetd, put the following entry
# in your /etc/inetd.conf:
#
# 8334    stream  tcp     nowait  user  /usr/sbin/tcpd  /path/to/owlbeek.sh
#
# Replacing "user" with the user to run the script as, and /path/to/owlbeek.sh with
# the real path to this script

COLOURS=( '' white black navy green red maroon purple olive yellow lime teal aqua blue fuchsia gray silver )
BEEK=`wget -O - -q http://lemons.plus.com/number.status || echo 0`
ERROR=""
if [ $BEEK -lt 1 ]; then
    BEEK=`expr $RANDOM % 16 + 1`
    ERROR=" (random)"
fi
echo "Owl beek status: ${COLOURS[$BEEK]}$ERROR"

