#!/bin/bash

#
# watch a log file and preform and action
# send a message to syslog with this command:
#	 logger -p auth.alert -t JOHNS_TEST "$LOGNAME's on $HOSTNAME is a freek!"
#

#watch for new enteries in the log file
mess_count_now=`wc -l /var/log/messages`
while [ 1 ]
do

	mess_count_new=`wc -l /var/log/messages`
	if [ "$mess_count_new" != "$mess_count_now" ]
	then
		echo "new entery in syslog."
		echo "mess_count_new=$mess_count_new"
		echo "mess_count_now=$mess_count_now"
		mess_count_now="$mess_count_new"
		message=`tail -n1 /var/log/messages`
		echo "$message"
				case $message in 
		"could not find any available" ) 
			
						;;
		"HTTPRequest::sendRequest" )
						;;
		"Hearbeat Timestamp exceeded TTL" )
						;;
		" Alert! winnt server down" )
						;;
		"CallLog.commit" )
						;;
		"last message repeated" )
						;;
		"GrammarLoader: handleException:" )
						;;
		"java.io.FileNotFoundException" )
						;;
		 "diamond.backend.TableMgr" )
						;;
		"diamond.services.OrderLocator::" )
						;;
		 "LogSender was unable to copy a log to host" )
		 				;;
				
		esac	
	fi

done

