To send a mail when the data in a folder changes


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting To send a mail when the data in a folder changes
# 1  
Old 01-08-2013
To send a mail when the data in a folder changes

Hi All,

i have a folder "fold" which will mostly have a date( like 1/2/2013 -a single date alone .whenever the date changes i shoud get a mail. could someone help me with this.
# 2  
Old 01-08-2013
Hi,

Could you provide us some more information or input ?

Thanks
Pravin
This User Gave Thanks to pravin27 For This Post:
# 3  
Old 01-08-2013
You can use stat command to get time of last modification log it to a file and compare it during each run:
Code:
#!/bin/bash

p_ts=$( cat fold_stat_mod )
c_ts=$( stat --format=%y fold | tee fold_stat_mod )

if [ "$p_ts" != "$c_ts" ]
then
        echo "Dir: fold modified" | mailx -s "Modified Alert" user@domain.com
fi

This User Gave Thanks to Yoda For This Post:
# 4  
Old 01-08-2013
Quote:
Originally Posted by mahesh300182
Hi All,<br />
<br />
i have a folder "fold" which will mostly have a date( like 1/2/2013 -a single date alone .whenever the date changes i shoud get a mail. could someone help me with this.
<br />
<br />
www changagoidemhn. com Bác r?nh vÃ*o ?ng h? em nhé !
# 5  
Old 01-09-2013
Hi pravin,

i shall try to explain my need. i have a folder name fold which contains a date and wheneer it changes i should get a mail with the newly changed date. the fold will contain only the date(01/09/2013). Thanks you!!!!.


Hi Bipinajith,

Thanks a lot for the prompt reply. i really feel happy that my issue is getting addressed. i will try the code you gave and will let you know the result.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

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

2. Ubuntu

Not able to send mail out of UbuntuBox in send mail

Hi Guys.. yesterday i purchased a VPS server and installed sendmail on ubuntu 12.4 with Webmin & Apache runing webserver problem is.. i can send mail via webmin user interface account to anybody to out side to any domain and able to recieve any mail from any domain.. Now main... (2 Replies)
Discussion started by: cmdman
2 Replies

3. UNIX for Advanced & Expert Users

How can I send a mail from my outlook or other mail accounts to UNIX server?

Hi all, I want to send a mail for my business needs from outlook account to an unix server (HP-UX) but I don't send any mail. While I can send from the unix server to my outlook account, I can't send from outlook to unix. How can I achieve this ? How can I send a mail from my outlook or other... (2 Replies)
Discussion started by: igelegin
2 Replies

4. Shell Programming and Scripting

Take Data From a table and send it through mail

Hi can anyone help me in writing a code for taking data from a table and need to send that data through mail using mail -x command.. (3 Replies)
Discussion started by: ginrkf
3 Replies

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

6. UNIX for Dummies Questions & Answers

How to send html file in a mail not as an attachment but it should display in the mail in table for

Hi The below script working when we are sending the html as attachment can u please guide how to send thesmae data in table form direct in the mail and not in mail attachment . cat Employee.sql SET VERIFY OFF SET PAGESIZE 200 SET MARKUP HTML ON SPOOL ON PREFORMAT OFF ENTMAP ON - HEAD... (0 Replies)
Discussion started by: mani_isha
0 Replies

7. Shell Programming and Scripting

Arrange Data in table and send by mail

Everybody, can you tell me how express about this; we have text data file as : parameter1 Parameter2 AA 55 BB 77 . . . . . . We want to draw table for this data as attached then send as body of Email (4 Replies)
Discussion started by: xjklop2009
4 Replies

8. Shell Programming and Scripting

How to convert the data into excel sheet and send mail using 'mailx' command

Hi all I have a shell script that uses a stored proc to generate output from some tables and send the same in an e-mail using mailx command. Now I need to convert the output to excel format and send e-mail. How can I achieve this. Please help me in this regard, as it's very urgent and I have been... (5 Replies)
Discussion started by: sanbabu
5 Replies

9. Shell Programming and Scripting

send a mail whenever a file is updated in certain folder or its subfolders

send a mail to a group of users whenever a file is updated in certain folder or its subfolders on an unix server (3 Replies)
Discussion started by: ashishabhishek
3 Replies

10. UNIX for Dummies Questions & Answers

can not send mail from unix server to company/yahoo mail

hi, Gurus, I need some help with sending mail out from my UNIX server: It is running Solaris 2.6 and the sendmail version is 8.8. Output of :/usr/lib/sendmail -d0.1 -bt < /dev/null Version 8.8.8+Sun Compiled with: LOG MATCHGECOS MIME7TO8 MIME8TO7 NAMED_BIND NDBM NETINET ... (5 Replies)
Discussion started by: b5fnpct
5 Replies
Login or Register to Ask a Question