inotifywait not detecting links
I have successfully created a watcher for modifications inside a directory, recursively:
inotifywait -m -r -e modify --format '%w%f' "$Path" | while read File
do echo "File $File is modified"
doneHowever, I have some symbolic links inside that directory. And when I open them in an editor and change them, inotifywait does not print anything.
I think it's because the actual files are in another directory.
How can I tell inotifywait to detect changes of links too?
1 Answer
You can't. inotifywait watches the symbolic links themselves, not the files they point to.
Behind the scenes inotifywait uses the inotify syscall with the IN_DONT_FOLLOW flag, which causes this behaviour. If you want to change that you would need to write your own inotifywait, without the flag.
I got this from this discussion.
3