check logfile size

Hello everyone!

Can anyone help me with this?

I need a script that looks at a logfile and check it�s size. If it�s over a sertain size the i should get an email. Dont really know how the grep that info "the size"

Please help....

FILE="my_log_file"
SIZE=123456
VAR=`ll $FILE | awk -F" " '{print $5}' `

if [ $VAR -gt $SIZE ]
then
mail me a message
fi

I cant remember if the file size is field 5 or not...check that.

I don't know about the ll command used above, but I think if it doesn't work for you then replace ll $FILE with wc -c $FILE. wc -c will give you the count of bytes of file $FILE.

FILE="my_log_file"
SIZE=123456
VAR=`wc -c $FILE | awk -F" " '{print $1}' `

if [ $VAR -gt $SIZE ]
then
mail me a message
fi

Regards,
Yeheya

FILE="my_log_file"
SIZE=123456
VAR=`wc -c $FILE | awk -F" " '{print $1}' `

if [ $VAR -gt $SIZE ]
then
mail me a message
fi

Either method should work. The long list will just print out the long listing entry for the file in question which then awk will pick off the file size. wc cuts out the file size and then awk prints it. Either method should work....pick the method that works best for you.

thanx that did the trick!!