How can I register to event that let me know when specific file is read in linux?
Can implement in c or in bash /shell script
How can I register to event that let me know when specific file is read in linux?
Can implement in c or in bash /shell script
Use inotify(7)
, inotify_add_watch(2)
with IN_ACCESS
, inotifywait(1)
, etc.
Example: In a window:
while read f; do echo "$f"; sleep 3; done </path/to/your/file
...
In another window:
inotifywait -me access /path/to/your/file
/path/to/your/file ACCESS
/path/to/your/file ACCESS
/path/to/your/file ACCESS
...