The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 05-15-2008
thecoffeeguy thecoffeeguy is offline
Registered User
 

Join Date: May 2008
Posts: 7
Create a script using DATE command?

Not even sure how to word this.
Basically, we have a log file that gathers all alerts for a system.

What I am doing is grepping through this file and grabbing certain strings that are outputted to a file, then mailed to a group.

Here is the catch. Since I cannot copy this file to a temp file and empty the contents of the original file (essentially, making the original file clean and empty and backing up the copy of the original file), I am now trying to only gather events that occur after certain times.

My thinking is that I have to use the date command. This script is going to run every 15 minutes. So, the trick is, how do I create the script to email me only any NEW alerts that occur every 15 minutes? Does that make sense?

Example:

1:00 - Script runs for the first time. No new errors, so nothing is emailed.
1:15 - Script runs again, this time, new errors. I want these errors to be emailed to the group.

I appreciate it.

TCG
Reply With Quote
Forum Sponsor