I need this script to keep reading a particular log ...???
Looking for the newest line with "Full GC" and if it goes over 900000 between "->" and "K"
Close? (script below)
----Log file----
[Full GC 1022116K->910000K(1047424K), 14.6826836 secs]
[GC 974797K->947362K(1047424K), 0.1525772 secs]
[GC 974797K->947362K(1047424K), 0.1525772 secs]
[GC 974797K->947362K(1047424K), 0.1525772 secs]
[GC 974797K->947362K(1047424K), 0.1525772 secs]
[GC 974797K->947362K(1047424K), 0.1525772 secs]
[GC 974797K->947362K(1047424K), 0.1525772 secs]
[GC 974797K->947362K(1047424K), 0.1525772 secs]
[GC 974797K->947362K(1047424K), 0.1525772 secs]
[GC 977826K->950446K(1047424K), 0.1339467 secs]
---Logfile--
Here is what I have so far:
#! /bin/ksh
while :
do
unset name
unset size
name=`tail -100 datafil.dat | cut -c2-8`
echo $name
size=`tail -100 datafil.dat | awk -F"->" '{ print $2 }' | awk -F"K" '{ print $1 }'`
echo $size
if [[ $name = "Full GC" && $size < 900000 ]]
then
echo "alert by mail"
exit 1
fi
sleep 5 &
wait
done
Looking for the newest line with "Full GC" and if it goes over 900000 between "->" and "K"
Close? (script below)
----Log file----
[Full GC 1022116K->910000K(1047424K), 14.6826836 secs]
[GC 974797K->947362K(1047424K), 0.1525772 secs]
[GC 974797K->947362K(1047424K), 0.1525772 secs]
[GC 974797K->947362K(1047424K), 0.1525772 secs]
[GC 974797K->947362K(1047424K), 0.1525772 secs]
[GC 974797K->947362K(1047424K), 0.1525772 secs]
[GC 974797K->947362K(1047424K), 0.1525772 secs]
[GC 974797K->947362K(1047424K), 0.1525772 secs]
[GC 974797K->947362K(1047424K), 0.1525772 secs]
[GC 977826K->950446K(1047424K), 0.1339467 secs]
---Logfile--
Here is what I have so far:
#! /bin/ksh
while :
do
unset name
unset size
name=`tail -100 datafil.dat | cut -c2-8`
echo $name
size=`tail -100 datafil.dat | awk -F"->" '{ print $2 }' | awk -F"K" '{ print $1 }'`
echo $size
if [[ $name = "Full GC" && $size < 900000 ]]
then
echo "alert by mail"
exit 1
fi
sleep 5 &
wait
done