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
Problem with Cron Email Notification sasaliasim AIX 1 04-29-2008 01:02 PM
Counting Files and send an email Notification if it exceeds a limit amitsayshii UNIX for Dummies Questions & Answers 10 07-07-2006 11:25 AM
How to add email notification in scripts? redlotus72 UNIX for Dummies Questions & Answers 2 03-14-2005 08:19 AM
Why am I not recieving email notification? Kelam_Magnus Post Here to Contact Site Administrators and Moderators 6 09-03-2002 11:01 PM
email notification if job is killed/dies jacob_gs Shell Programming and Scripting 2 05-15-2002 03:29 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-02-2008
coolkid coolkid is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 69
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
  #2 (permalink)  
Old 01-02-2008
PxT's Avatar
PxT PxT is offline Forum Advisor  
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
  #3 (permalink)  
Old 01-02-2008
coolkid coolkid is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 69
Thank You PXT.
  #4 (permalink)  
Old 01-02-2008
coolkid coolkid is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 69
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 04:17 PM..
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 03:28 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