Create a script using DATE command?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Create a script using DATE command?
# 1  
Old 05-15-2008
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
# 2  
Old 05-15-2008
i) grep out the dates and compare whether or not the incidents happened in the last 15 minutes
ii) use logcheck, a complete, mature package that exactly does what you want (it even takes care about what is relevant (can be hand-tuned) to be reported and what not)
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replacing Date in the file with Create date and timestamp

Hello, I have files that with a naming convention as shown below. Some of the files have dates in the file name and some of them don't have dates in the file name. imap-hp-import-20150917.txt imap-dell-gec-import-20150901.txt imap-cvs-import-20150915.txt imap-gec-import.txt... (8 Replies)
Discussion started by: Saanvi1
8 Replies

2. Shell Programming and Scripting

Command / Script to create touch file in destination server

Hello Team, Is there any Linux command / script available so that, I could create a simple 0 byte file in destination server by issuing the command from source server. If yes, Could you please let me know the possible solutions. in other words I just want to create a touch file in my home... (1 Reply)
Discussion started by: madhuraju
1 Replies

3. Shell Programming and Scripting

Please help, need to create script to remove lines by date in file

Please Help (novice to PERL and SHELL scripting)…. Need to create a script which removes all lines in $filename = "cycle_calendar_ftp_out" older than current date – a variable which will be a number of days passed to script. For Ex it will look at the end date which is the last field (4) and... (2 Replies)
Discussion started by: m3pwr
2 Replies

4. Shell Programming and Scripting

Create a Date Check Script

I have about 100 Linux servers running in Amazon EC2 (CentOS 6 based) and I need to run a 'date' command against all of them. Rather than logging into each individual server via 'ssh' and running the 'date' command, can someone please help me with how something like this can be scripted? I... (6 Replies)
Discussion started by: cmennens
6 Replies

5. UNIX for Dummies Questions & Answers

TWO QUESTIONS...How to create your own command in UNIX server,How to enter data in a file by script

I am a quite newbie on UNIX SCRIPTING...Please help me solving this two questions... 1st Question; I want to create one command that will run a script when anyone use that command on that server... I mean, in the prompt if I put my name 'Rony' it will execute a script called 'rony.sh'. How can... (1 Reply)
Discussion started by: Rony-123
1 Replies

6. Shell Programming and Scripting

help to create script for added date to list users

hi my friends im asking for the possibility to creat a script in ubuntu for added date to list users for doing this : - search in debug connected user of all connected users - if a new user is connect for the first time to my server the script record the date of the connection and added it... (1 Reply)
Discussion started by: amzioujda
1 Replies

7. Shell Programming and Scripting

date command in a shell script

It's perhaps a dummy question... but I don't find my way! 1) When I put the date command in a variable, it is ok and here the code : WEEK_DAY=`date +%w` DAY=`date +%Y%m%d` echo WEEK_DAY : "$WEEK_DAY" echo DAY : "$DAY" 2) I should to get direct the date and not in a variable, like : echo... (3 Replies)
Discussion started by: hiddenshadow
3 Replies

8. UNIX Desktop Questions & Answers

trying to create a script to read a flie and loop a command...

I tried to explain this earlier, but did a poor job of it. So I am trying again but taking a different approach..... I have a file called test_words. In this file I have one line with 5 three letter words, with a single space seperating the words.(I.e., "cat car mop red pin") I want to... (5 Replies)
Discussion started by: Italy87
5 Replies

9. UNIX for Advanced & Expert Users

trying to create a script to read a flie and loop a command...

Tried to explain this earlier, but did a poor job of it. So I am trying again but taking a different approach..... I have a file called test_words. In this file I have one line with 5 three letter words, with a single space seperating the words.(I.e., "dog car mop red pin") I want to create a... (1 Reply)
Discussion started by: Italy87
1 Replies

10. Shell Programming and Scripting

Need help to create a date script

So I need to create a shell script that can take as input a numeric day, month and year and output the day of the week for the input date. So let's say, I input "programname 19 10 2006" it should output Thursday... I tried messing around with the grep and awk commands, but I can't get it to... (6 Replies)
Discussion started by: mredwardlee
6 Replies
Login or Register to Ask a Question