The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Servers, email notifications drl Post Here to Contact Site Administrators and Moderators 1 09-15-2007 04:40 PM
Locking a file when using VI to prevent multiple-edit sessions by diff users Browser_ice AIX 14 11-23-2006 10:43 AM
Prevent file from being mailed multiple times from a job Sree_2503 Shell Programming and Scripting 2 11-14-2006 12:47 PM
Sending Multiple Files through email nbvcxzdz Shell Programming and Scripting 4 03-29-2005 09:49 AM
trying to turn email notifications off oombera Post Here to Contact Site Administrators and Moderators 2 05-21-2003 03:54 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-07-2007
si_linux si_linux is offline
Registered User
  
 

Join Date: Jul 2006
Location: UK
Posts: 6
how to prevent multiple email notifications from monitoring script

Hi everyone,

I am in the process of trying to decide the correct way to solve a particular scripting/email issue I have and would appreciate any advice.

We have a cronjob running every 10 mins to check disk size on the server and if this exceeds a certain percentage then it will email a notification warning out to relevant people.

However once the first email has been sent I would like it to refrain from sending a fresh email every 10 mins until the disk size have been resolved - maybe then just send a reminder every hour or two.

The only way I can think of (with my limited scripting knowledge) would be to create a separate file which would be used as a 'checking' file to see when the last email was sent. So if the checking file indicates that an email was sent in the last hour then no emails will be sent etc.

Hope this makes sense as did not want to write a long expanse of details. Also this is to run on Solaris 9.

Any suggestions gratefully received.

Thanks

Si
  #2 (permalink)  
Old 06-07-2007
cbkihong cbkihong is offline Forum Advisor  
Advisor
  
 

Join Date: Sep 2002
Location: Hong Kong, China
Posts: 1,624
I had an HTTP monitoring Perl script written some years ago driven by cron once every 5 minutes with similar reporting facility. What I did was even simpler - to create a state file with just "0" or "1" to indicate whether an alert mail has been sent before. When a later run sees "1", it will not send the mail again (but will still log the error). When the service is up again, the next run will reset the file content to "0". Basically, if there was no file or the file content is "0", a mail will be sent and overwrite the file with a "1" if some tests failed.

As a simple monitoring facility, it worked for me. Of course, you may wish to also save a checksum of the error message and compare against the current message to see whether the error message has changed, in which case I think another message should be sent even though some trouble mail has been sent in the past.
  #3 (permalink)  
Old 06-07-2007
si_linux si_linux is offline
Registered User
  
 

Join Date: Jul 2006
Location: UK
Posts: 6
Hi cbkihong,

Thank you very much for the swift reply!

I had not thought of that method using the error state of the command. Thinking about it this should work fine and will save me from having so many emails.

Thanks again.

Si
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:56 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0