Sponsored Content
Full Discussion: Help me in finding logic
Top Forums UNIX for Dummies Questions & Answers Help me in finding logic Post 302306094 by laurentv on Saturday 11th of April 2009 01:19:12 AM
Old 04-11-2009
aks,

Here is an example for what your wotsrc could be, assuming:
- The alert frequency will be every 10 minutes
- Lines containing the expression "TimeOutException" and "OutOfMemoryException" in file /var/log/TraceLog.log will trigger an email
- You want to be alerted for any logged message in /var/log/Critical.log except messages starting with "Test"
---- start of wotsrc ----
config poll 600

from /var/log/TraceLog.log
/.*TimeOutException*./ mail=yourself@yourmail.net
/.*OutOfMemoryException*./ mail=yourself@yourmail.net

from /var/log/Critical.log
/Test/ ignore
/(.*)/ mail=yourself@yourmail.net
----end of wotsrc ----

you may start it using that script from /etc/init.d/wots

#!/sbin/sh

WOTS_CFG=/usr/local/etc/wotsrc
WOTSPID=/var/run/wots.pid

case "$1" in
start)

# WOTS
#
touch $WOTSPID
chgrp nobody $WOTSPID
chmod 664 $WOTSPID
su nobody -c "/usr/local/bin/wots --config=$WOTS_CFG --pidfile=$WOTSPID &"
;;

restart) ;;
stop)
if [ -f $WOTSPID ]; then
kill -15 `cat $WOTSPID`
fi
;;
esac

- Laurent
 

We Also Found This Discussion For You

1. Shell Programming and Scripting

finding duplicate files by size and finding pattern matching and its count

Hi, I have a challenging task,in which i have to find the duplicate files by its name and size,then i need to take anyone of the file.Then i need to open the file and find for more than one pattern and count of that pattern. Note:These are the samples of two files,but i can have more... (2 Replies)
Discussion started by: jerome Sukumar
2 Replies
All times are GMT -4. The time now is 03:58 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy