Visit Our UNIX and Linux User Community


Detect changes in a file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Detect changes in a file
# 1  
Old 04-14-2009
Detect changes in a file

Hi all
Just curious , is it possible to detect changes in a file and sent to email .


For ex: demo.conf

I would like to receive an email everytime a particular file(demo.conf) changes and the content added/removed and who did the change (userid). Is it possible.


Thanks
CK
# 2  
Old 04-14-2009
Yes and no!

You can easily write a script that polls the file statistics every so often and looks for change from the last poll. If the file's changed you can then compare the current file to a previously saved version and email out the differences.
What you can't do is tell who made the change - that info isn't stored.
# 3  
Old 04-14-2009
you can use tools like md5sum, md5,sha1 to check for changes. as for who did it, one of the ways is to turn on auditing on your platform.
# 4  
Old 04-15-2009
Quote:
Originally Posted by ghostdog74
one of the ways is to turn on auditing on your platform
In many years of being a Unix user, I've never come across platform auditing! Can you provide some background please?
# 5  
Old 04-15-2009
Quote:
Originally Posted by JerryHone
In many years of being a Unix user, I've never come across platform auditing! Can you provide some background please?
if you are in Solaris platform, you can turn on BSM. If in Linux, then turn on audit daemon ( auditd)

Previous Thread | Next Thread
Test Your Knowledge in Computers #352
Difficulty: Easy
Unix was created 25 years before Linux.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Detect blank spaces in a CSV file

I'm monitoring a WLAN network to keep track of new SSIDs popping up. The SSIDs are stored along with the AP MAC address and a few other parameters in a CSV file. A typical line could look like this: 18:70:9f:e3:80:aa 10:11:15 MyNetwork 2437 Now, the problem is that some networks use SSIDs... (4 Replies)
Discussion started by: Zooma
4 Replies

2. Shell Programming and Scripting

Script to detect dynamic ip change and update to config file

Hi All, I am newbie here and request your assistance. I have a service running on public ip, but since I have a dynamic IP it keeps on changing and every time I need to manually get the new ip and add to the config file and restart the service. This has become bit time consuming. Hence, I... (4 Replies)
Discussion started by: Shaan_Shaan
4 Replies

3. Solaris

detect if file is bzip compressed on solaris 10

Hi, I recently tried to create a tar archive on a Solaris 10 machine with gnu tar 1.17 and I used the command gtar -cjf filename.tar file1 file2 directory. The creation was successful but I'm not sure if the file was compressed with bzip as the j option is supposed to do. How can I check that it... (2 Replies)
Discussion started by: olam
2 Replies

4. Shell Programming and Scripting

script to detect a file from inserted usb and puts into a Variable

There is a same named log file that I have on my 2 different android phones. When I plug it into my computer, it appears in the media folder, For example the first android phone: /media/F6BA-0AF5/folder/A.log I want to put that into a variable to be manipulated.... (3 Replies)
Discussion started by: tobenguyen
3 Replies

5. UNIX for Advanced & Expert Users

Shell to detect the end of file

Hi. I'm not UNIX expert, I need to do a shell to read a sequential file and show in the console the record numbers read, until the end of file. The reason of this shell is to be sure if the file is not corrupt. Thanks (1 Reply)
Discussion started by: hornam
1 Replies

6. Shell Programming and Scripting

Detect duplicated words in file

I have big spooled file which contains thousands of user account Ids. I'd want to find the duplicates of the ids in the file. Say those ids are words with numbers + alphabets, no special characters. We want to detect the duplicates of the words and put the duplicated words in another file. TIA ... (13 Replies)
Discussion started by: gadba
13 Replies

7. Shell Programming and Scripting

AWK script to detect webpages from file

Hi guys I'm very new to unix and I have to create an awk script that detects webpage addresses from a file/webpage and outputs how many times each webpage was detected.e.g. if my file was: www.google.com www.facebook.com www.google.com the output should be: www.google.com x2... (2 Replies)
Discussion started by: ROFL
2 Replies

8. Shell Programming and Scripting

AWK script to detect webpages from file

Hi guys I'm very new to unix and I have to create an awk script that detects webpage addresses from a file/webpage and outputs how many times each webpage was detected.e.g. if my file was: (Note: The symbol " was added to stop them being created into links) "www.google.com"... (1 Reply)
Discussion started by: ROFL
1 Replies

9. UNIX for Dummies Questions & Answers

detect file size then quit or continue

Hi Guys, I'm running a cron that mails me a file every night. The file is based on form input from the web and each evening after I mail it I delete and start a new file by the same name. It's a csv file so I preload a line of headers into the file. So far, so good. On days when no one inputs... (5 Replies)
Discussion started by: steven99
5 Replies

10. Shell Programming and Scripting

Unix script to detect new file entry in directory

Hi All, I want to detect each new file coming / getting created in unix directory. When every new file came to directory, i have to get its details like its size , date and time stamp and store it into another file. Could any one please tell me , how i can achieve that? Thanks. (13 Replies)
Discussion started by: james_1984
13 Replies

Featured Tech Videos