LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-12-2009, 04:01 AM   #1
scofiled83
Member
 
Registered: Nov 2008
Posts: 70

Rep: Reputation: 15
prevent grepping same value in logfile


Hello

I have log file name alert.log which is updated frequently.


If there is an error in this logfile which start with ORA-..
I want to send the error message as an email.

Assume I have a cron job which performs this task every 5 minutes.
What I wanna ask is:
If ORA- error occurs,it will send an email,5 minutes later it will again send the same email, and so on.

How can I prevent duplicate emails? (Hp-Unix)

Last edited by scofiled83; 07-12-2009 at 04:37 AM.
 
Old 07-12-2009, 04:35 AM   #2
scottro11
Member
 
Registered: Jun 2009
Location: NYC
Posts: 263

Rep: Reputation: 59
I have a post on CentOS forums about using swatch that might do what you want.


http://www.centos.org/modules/newbb/...&post_id=78114
 
Old 07-12-2009, 10:49 AM   #3
raj77_in
LQ Newbie
 
Registered: Oct 2008
Posts: 26

Rep: Reputation: 15
another option could be copy the file to /tmp or any other place and then do the grep. Next run, grep on the diff of two files and overwrite the earlier file.
 
Old 07-12-2009, 11:28 PM   #4
scofiled83
Member
 
Registered: Nov 2008
Posts: 70

Original Poster
Rep: Reputation: 15
Hi
I am not clear with your suggestion.
Could you give an example?
 
Old 07-13-2009, 02:07 AM   #5
PMP
Member
 
Registered: Apr 2009
Location: ~
Distribution: RHEL, Fedora
Posts: 381

Rep: Reputation: 58
What i will suggest you is to put a marker in the file when you are done sending mail, and then next time start from this marker.
 
Old 07-13-2009, 07:00 AM   #6
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Quote:
Originally Posted by scofiled83 View Post
Hi
I am not clear with your suggestion.
Could you give an example?
Whose post are you replying to? Regardless, tell us exactly which part you don't understand.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
grepping lines... visitnag Linux - Newbie 4 06-26-2008 01:22 PM
Shell scripting: Print output to logfile, error to logfile & screen stefanlasiewski Programming 18 05-22-2008 12:47 PM
Advanced Grepping keysorsoze Linux - General 10 04-20-2007 06:00 AM
grepping all manfiles pgrodt Linux - Software 8 12-01-2006 10:40 AM
Not grepping emails right mikeyt_333 Linux - General 11 04-13-2003 02:48 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:15 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration