Search code examples
fileprocessfile-sharing

Notify when the file contents are changed


There are two processes which will be accessing a file. Whenever, the file contents are modified in one process, I need to read the file and update something in the other process. Can you please tell me how to do this. I am not asking for code. just give the idea to do that. maybe some links, which would help me to acheive this. I saw something FindFirstChangeNotification for windows environment. I need something similar to this in linux environment

Thanks,


Solution

  • Take a look at the python watchdog package. It provides cross platform file change monitoring, using a variety of techniques (depending on the platform). Even if you're not using python, you can use the ideas/techniques for the language of your choice. The watchdog page also mentions similar packages, should you be interested in further research.