I'm using the following bash script to test inotifywait.
while true; do
inotifywait -r -e modify,create,delete "$DIRECTORY_TO_WATCH"
done
inotifywait is listening to created files:
/directory_to-watch/ CREATE test (copy).sh
Also modified files:
/directory_to-watch/ MODIFY test.sh
But say, I copy a file and then delete it, inotifywait doesn't log anything. What's happening?
inotifywait
after every event, and with recursion it may have a fairly slow start-up procedure (and be a considerable resource issue). That means there is a race condition against therm
command. Try removing thewhile true
loop, and using the--monitor
option ininotifywait
.fatrace -t -f 'WD<>+'
?inotifywait -r -m -e modify,create,delete "$DIRECTORY_TO_WATCH"
(and without the-r
). Still, nothing is logged when I delete a file.