I want to use the inotify mechanism on Linux. I want my application to know when a file aaa was changed. Can you please provide me with a sample ho
If all you need is a commandline application, there is one called inotifywait that watches files using inotify
from terminal 1
# touch cheese
# while inotifywait -e modify cheese; do
> echo someone touched my cheese
> done
from terminal 2
echo lol >> cheese
here is what is seen on terminal 1
Setting up watches.
Watches established.
cheese MODIFY
someone touched my cheese
Setting up watches.
Watches established.
Update: use with caution and see the comments.