BB Unix Network Monitor - Message

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

{bb} Big Brother Text Console



Hello,

Thanks to all the benefits I've reaped from Big Brother, I'd like to
contribute something back to the BB community. The following script is a
Linux text console I created for monitoring BB status without a web
browser.

For more BB hacks I've made, see
http://c455.hfcc.net/bb/hacks/index.html. Help yourself to anything you
find useful!

Micah Webner,
Access/Interactive, Inc.
for Henry Ford Community College

#!/bin/sh

# bbconsole
# by Micah Webner - Henry Ford Community College
# Version 1.00
# Jun 1st, 1999
#
# based on mkbb.sh by
# Sean MacGuire - The MacLawran Group Inc.
# Version 1.09b
# Feb 21st, 1999
#
# This program is Copyright (c) 1997-1999
# The MacLawran Group Inc.
# All Rights Reserved

#reset the screen to a sane state on break
trap '/usr/bin/setterm -reset; exit 0' 0 1 2 15

#### This is REQUIRED #####
BBHOME="/usr/local/bb"
export BBHOME

if test ! "$BBTMP"                      # GET DEFINITIONS IF NEEDED
then
  . $BBHOME/etc/bbdef.sh          # INCLUDE STANDARD DEFINITIONS
fi
SETTERM="/usr/bin/setterm"

$SETTERM -blank 0 -cursor off

while /bin/true
do

  BBBKG=`${BBHOME}/web/mkbb.bkg`  # GET THE BACKGROUND COLOR
  BBDATE=`${DATE}`   # SET THE DATE

  # Set the screen color to match current status
  # remap purple to magenta for Linux setterm

  BGCOLOR=$BBBKG
  if [ "$BGCOLOR" = "purple" ]
  then
    BGCOLOR=magenta
  fi
  $SETTERM -background $BGCOLOR -foreground white -bold -clear
  echo
  echo " Big Brother is watching you!"
  echo " $BBDATE"
  echo
  echo " scanning for problems..."
  echo

  COLUMNS=`${BBHOME}/web/mkbb.cols` # GET OUR COLUMN HEADINGS

  $CAT $BBHOSTS|
  while read line
  do
    set $line > /dev/null
    echo $1 | $GREP "^[0-9]" > /dev/null
    if test "$?" = "0"  # VALID HOST
    then
      NAME=`echo $2|cut -d. -f1`
      FIRST="YES"
      for column in $COLUMNS
      do
        if test -f "$BBLOGS/$NAME.$column"
        then
          set `$CAT $BBLOGS/$NAME.$column` > /dev/null
          if [ "$1" != "green" ]
          then
            if [ "$FIRST" = "YES" ]
            then
              echo -n "  $NAME "
              FIRST="NO"
            fi
            FORECOLOR=$1
            if [ "$FORECOLOR" = "purple" ]
            then
              FORECOLOR=magenta
            fi
            $SETTERM -background black -foreground $FORECOLOR
            echo -n "$column"
            $SETTERM -background $BGCOLOR -foreground white
            echo -n " "
          fi
        fi
      done
    if [ "$FIRST" = "NO" ]
    then
      echo
    fi
  fi

  done
  echo
  echo " snoozing..."
  sleep 30
done


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Please send mail for the mailing list to: bb@taex001.tamu.edu
  To [un]subscribe to this list, send e-mail to majordomo@taex001.tamu.edu
     with [un]subscribe bb in the BODY of the message.
  Please contact the mailing-list-owner as: bb-owner@taex001.tamu.edu


Home | Main Index | Thread Index