Sponsored Content
Top Forums Shell Programming and Scripting I want my script to NOT to send an e-mail if it finds the same keyword more than twice. Post 302926728 by Don Cragun on Wednesday 26th of November 2014 12:09:44 PM
Old 11-26-2014
Quote:
Originally Posted by Rajeshneemkar
Yes, the script is run via CRON (every minute)
Yes, it looks for keyword from the "new" part of log file
Yes, I received more than 500 same e-mail, when the same error occured more than 500 times
No of e-mails is proportional to no of (same)error messages, whihc i dont want. (I want only one e-mail if the error is recurring)

Thanks
Rajesh

---------- Post updated at 09:41 AM ---------- Previous update was at 09:23 AM ----------

Consider the following situation
Code:
JS: js__callout: Not yet time for sjobid 137, calloutid 471531
JS: js__callout: Not yet time for sjobid 137, calloutid 471531
JS: js__callout: Not yet time for sjobid 137, calloutid 471531
JS: js__callout: Not yet time for sjobid 137, calloutid 471531

I receive an 4 e-mails if the same error is repeating.
Now imagine the situation with 500 errors (same and continous)

What I'm looking at is, if the script detects the same error as detected earlier (due to continous errors generated by the server), it should not send me an e-mail for the second time. Just one e-mail is enough.

This is just to stop inbox full situation
I guess I still don't understand your requirements. You show four lines above and say you only want one message for those four lines (not four messages), but none of the keywords in either of the egrep commands in your script are in those four lines. So, why should any message be sent?

Let me see if I understand what you're trying to do. You're running your log processor every minute, and you're only looking at new messages in the log file each minute. So, are you saying you want a mail message each minute of the day in which that error is reported? With the sixteen keywords in your 1st egrep (there are only fourteen in the 2nd egrep) do I correctly understand that you're OK getting 16 messages each minute for each minute of the day (for a maximum of 23,040 messages in your mailbox each day) as long as no two messages sent by any invocation of your log checker contain the same keyword? Are the lines that you show above supposed to generate mail messages or not? (As I said before, none of your keywords are present in those lines.)

Why are you counting sixteen keywords as errors but only sending e-mail for fourteen of those keywords?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Send e-mail in Shell script

How to send an error mail from a shell script e.g. mail destination_adr@blabla.int "Message : here an error message " thanks, Ann. (1 Reply)
Discussion started by: annelisa
1 Replies

2. Shell Programming and Scripting

Script to send a mail in UNIX

Hi, I need to write one unix script gor sending a mail notification. I have to pass the followinf as arguments,from ,to,subject,messege body Can i use mailx....Please provide the code Thanks in advance. (1 Reply)
Discussion started by: sudhi
1 Replies

3. UNIX for Advanced & Expert Users

need to configure mail setting to send mail to outlook mail server

i have sun machines having solaris 9 & 10 OS . Now i need to send mail from the machines to my outlook account . I have the ip adress of OUTLOOK mail server. Now what are the setting i need to do in solaris machines so that i can use mailx or sendmail. actually i am trying to automate the high... (2 Replies)
Discussion started by: amitranjansahu
2 Replies

4. Shell Programming and Scripting

Help-send mail script

Hi, I have written one script for sending mails with attachment. currently its working for only one recipient. I want to send mails to n number of users by taking user input i.e number of users. Output of current script: Enter how many files : 1 Enter First Name : kiran E-Mail... (2 Replies)
Discussion started by: kiran_j
2 Replies

5. Shell Programming and Scripting

script to send mail !!

Hi Experts.. i have created a table with the fields, empid name mailid 1 raja raja@xy.com and entered the values of all persons who are in that file... i have a .csv file date shift1 shift2 6/6/2011 ram raja Now i want a script that could fetch the data in (input file .csv file) and... (3 Replies)
Discussion started by: cratercrabs
3 Replies

6. Shell Programming and Scripting

not able to send the mail through perl script

I have written small piece of code to send mail through perl script.Below is the code.I have executed it as # perl perlmail.pl and the code got executed with no errors. Still have not received any mail. Also I have installed Mail::send module from CPAN directly but no luck. Could any mail... (2 Replies)
Discussion started by: giridhar276
2 Replies

7. Shell Programming and Scripting

Script Contain Send Mail via Telnet

Dear Masters, I am using Solaris 10 and bash shell. I make a script for checking if a file is exists on the specified folder or not from 5th day of the month until the end of the month. If the file doesn't exist, the script will send email to me. The script ran perfectly when I execute it on... (6 Replies)
Discussion started by: kris.adrianto
6 Replies

8. Shell Programming and Scripting

Ksh: Send a mail in case grep finds something

I want to search a file if it contains special strings and if yes, the records found should be mailed. I can either do it with a temporary file: /usr/bin/grep somestring somefile > /tmp/tempfile && /usr/bin/mail -s "Found something" email@mycomp.com < /tmp/tempfile... or by running the grep... (10 Replies)
Discussion started by: Cochise
10 Replies

9. Shell Programming and Scripting

A shell script to run a script which don't get terminated and send a pattern from the output by mail

Hi Guys, I am very new to shell script and I need your help here to write a script. Actually, I have a script abc.sh which don't get terminated itself. So I need to design a script to run this script, save the output to a file, search for a given string in the output and if it exists send those... (11 Replies)
Discussion started by: Sambit Sahu
11 Replies

10. UNIX for Advanced & Expert Users

Client was not authenticated to send anonymous mail during MAIL FROM (in reply to MAIL FROM comm

I am having trouble getting mail to work on a red hat server. At first I was getting this message. Diagnostic-Code: X-Postfix; delivery temporarily suspended: connect to :25: Connection refused Then added the port to my firewall. Then I temporarily turned off selinux. I then copied this file... (1 Reply)
Discussion started by: cokedude
1 Replies
CRON(8) 						      System Manager's Manual							   CRON(8)

NAME
cron - clock daemon SYNOPSIS
auth/cron [-c] DESCRIPTION
Cron executes commands at specified dates and times according to instructions in the files /cron/user/cron. It runs only on an authentica- tion server. Option -c causes cron to create /cron/user and /cron/user/cron for the current user; it can be run from any Plan 9 machine. Blank lines and lines beginning with # in these files are ignored. Entries are lines with fields minute hour day month weekday host command Command is a string, which may contain spaces, that is passed to an rc(1) running on host for execution. The first five fields are integer patterns for minute 0-59 hour 0-23 day of month 1-31 month of year 1-12 day of week 0-6; 0=Sunday The syntax for these patterns is time : '*' | range range : number | number '-' number | range ',' range Each number must be in the appropriate range. Hyphens specify inclusive ranges of valid times; commas specify lists of valid time ranges. To run the job, cron calls host and authenticates remote execution, equivalent to running rx host command (see con(1)). The user's profile is run with $service set to rx. Cron is not a reliable service. It skips commands if it cannot reach host within two minutes, or if the cron daemon is not running at the appropriate time. EXAMPLES
Here is the job that mails system news. % cat /cron/upas/cron # send system news 15 8-17, 21 *** helix /mail/lib/mailnews % SOURCE
/sys/src/cmd/auth/cron.c SEE ALSO
con(1), rc(1) CRON(8)
All times are GMT -4. The time now is 11:00 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy