#!/bin/sh
#
# ex3
# BIG BROTHER EXAMPLE 2 PAGER SCRIPT FOR NON STANDARD RECIPIENT
# Robert-Andre Croteau
# Version 1.9
# Mar 13th, 2002
#
# (c) Copyright Quest Software, Inc.  1997-2002  All rights reserved.

#
# Usage: ex3
#

# The following variables are available thru the environment
# 
# BBALPHAMSG - Default message defined 
# ACKCODE - Notification associated ack code
# BBHOSTNAME - hostname in www.xxx.com format
# BBHOSTSVC - host in www.xxx.com.disk format
# BBHOSTSVCCOMMAS - host in www,xxx,com.disk format
# RCPT - recipient 
# MACHIP - IP address of host in normalized 12 digits AAABBBCCCDDD
# BBSVCNAME - name of service
# BBSVCNUM - numeric equivalent of service (from svcerrlist in bbwarnsetup.cfg)
# BBNUMERIC - ${MACHIP}${BBSVCNUM}
# BBCOLORLEVEL - Color level 
# DOWNSECSMSG - Default recovery string
# DOWNSECS - # of seconds to recovery
# RECOVERED - 1 in recovery mode, anything else non-recovery mode

#
# The RCPT value contains the real recipient value.  It was
# stripped of its ext-XXX- prefix (where XXX is what you called
# your notification script, in this example it would be ext-ex3-<recipient>)
#

if [ "$BBTMP" = "" ]
then
	echo "BB environment not set !!!"
	exit 1
fi

#
# Send a shortened message to mail recipient
#

echo "
BBALPHAMSG - $BBALPHAMSG
ACKCODE - $ACKCODE
BBHOSTNAME - $BBHOSTNAME
BBHOSTSVC - $BBHOSTSVC
BBHOSTSVCCOMMAS - $BBHOSTSVCCOMMAS
RCPT - $RCPT
MACHIP - $MACHIP
BBSVCNAME - $BBSVCNAME
BBSVCNUM - $BBSVCNUM
BBNUMERIC - $BBNUMERIC
BBCOLORLEVEL - $BBCOLORLEVEL
DOWNSECSMSG - $DOWNSECSMSG
DOWNSECS - $DOWNSECS
RECOVERED - $RECOVERED
" | $MAIL "BB" "$RCPT"

exit 0
