Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do i setup a mail alert for changes to a directory in my server? 3

Status
Not open for further replies.

dikachi

Programmer
Oct 4, 2006
1
GB
would someone be so kind as to tell the unix script i need for the following.

i have a srver called myserv and a directory called servy. now i want to be alerted by way of mail whenever a new file is saved or an old filed modified in that directory (i.e. servy directory) - basically be informed of changes to diretory and content. I am new to unix and the shell is tcsh.

thanx
 
man touch
man find (-newer primary)
man sendmail (or mailx)

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
To flesh out PHV's clues a little, basically you want to create a cron job that will run a script on a regular basis. See man crontab for details.

That script can then use find to search for files that have been modified since the last time you checked by comparing it to the date of a flag file, which you can create using touch. When it does find such a file, you can email the find output to yourself using mail or mailx (depending on OS), and then update the timestamp on the flag file using touch again.

Have a go and let us know where you get stuck.

Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top