Pager Alert

I want to check the log file continoulsy and to send a page alert if i see specific message like Reached Max Connrctions . Please suggest how to do this through script
DO i need to enable the cronjob to run the script evey 5 min or what is the best way

See man tail, -f option, much slicker way in than a timed poll, low latency, too. You can use grep to find the line number of the last hit, and tail after that line, if you want to restart it seamlessly after a hit. Maybe something like this, to continue after each hit:

 
while tail -f +0$last_hit_line $log_file | grep -q 'your_patern'
do
 tail -f +0$last_hit_line $log_file | grep -n 'your_patern' | tail -1 | read last_hit_line x
 .
 .
 .
done

hi i need to monitor the log file and need to perform the series of steps as soon as i see some text .the below code is just greeping data .

the rest gap is for self-study.

Well, methods vary. Do whatever in the loop. I like:

echo "Identifying message" | mailx -s "$(uname -n):Subject-topic" pager_email_address