LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Track File modification (https://www.linuxquestions.org/questions/programming-9/track-file-modification-386332/)

dhammika 11-25-2005 02:37 AM

Track File modification
 
Hi all


Can anyone help me to write a program to track a file modification?
on line in a UNIX system.

In detail

If i have file call test.txt in a directory. And a particular program is appending or modify that file. And that program is compiled and no way to change. When it starts appending or modification I need to track the original file before it change.

Thanks

Hko 11-25-2005 06:03 AM

There exist programs (daemons) that can notify other programs (applications) when certain files change.

I don't have any experience with them, so I'm not sure if they can notify other programs before the change occurs. I think that may not be possible.

But you could copy your test.txt before starting your program. Then have "fam" or "dnotify" notify another program when the files changes, and make a new copy of test.txt.

Some information on file-change notifying daemons ("fam" or "dnotify"):

http://www.devchannel.org/devtoolsch.../2146252.shtml
http://savannah.nongnu.org/projects/fam/
http://www.lambda-computing.com/projects/dnotify/
http://www.die.net/doc/linux/man/man1/dnotify.1.html


All times are GMT -5. The time now is 11:45 PM.