The UNIX and Linux Forums  

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 here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Problem with Cron Email Notification sasaliasim AIX 1 04-29-2008 09:02 AM
Counting Files and send an email Notification if it exceeds a limit amitsayshii UNIX for Dummies Questions & Answers 10 07-07-2006 07:25 AM
How to add email notification in scripts? redlotus72 UNIX for Dummies Questions & Answers 2 03-14-2005 05:19 AM
Why am I not recieving email notification? Kelam_Magnus Post Here to Contact Site Administrators and Moderators 6 09-03-2002 07:01 PM
email notification if job is killed/dies jacob_gs Shell Programming and Scripting 2 05-15-2002 11:29 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 01-02-2008
Registered User
 

Join Date: Jan 2008
Posts: 44
Crontab change and email notification

Hey guys
Just need some help with crontab.Iam looking for a script that will alert particular user about its change through sendmail.We are using bash here.

--CoolKid
Reply With Quote
Forum Sponsor
  #2  
Old 01-02-2008
PxT's Avatar
PxT PxT is offline
Registered User
 

Join Date: Oct 2000
Location: Sacramento, CA
Posts: 909
I'm sure there are many ways to do it. One would be to watch the MD5 of the file, and send a mail when it changes.

Code:
ORIGMD5=`crontab -l | md5sum`

while ( true )
do
   NEWMD5=`crontab -l | md5sum`
   if [[ "$ORIGMD5" != "$NEWMD5" ]]
   then
      echo "crontab changed" | mail you@example.com
      ORIGMD5=$NEWMD5
   fi
   sleep 60
done
Reply With Quote
  #3  
Old 01-02-2008
Registered User
 

Join Date: Jan 2008
Posts: 44
Thank You PXT.
Reply With Quote
  #4  
Old 01-02-2008
Registered User
 

Join Date: Jan 2008
Posts: 44
do we have to include the path as well of the sendmail for a group of users

Last edited by coolkid; 01-02-2008 at 01:17 PM.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 10:10 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0