[conspire] How reliable is inotifywait?

Steve Litt slitt at troubleshooters.com
Sun Mar 10 15:06:14 PDT 2024


Hi all,

The inotifywait program waits until a specific file event happens in a
specific directory or file, and then terminates. So it enables
file-driven event driven programs.

I'd like to wake up the instant a file appears in a directory.
Something like the following:

inotifywait -e create -e moved_to -t 30 /tmp/pager

The preceding waits 30 seconds, except if a file is created in or moved
to /tmp/pager, it quits waiting and terminates immediately.

I use it to combine polling with an event driven, so if for some reason
the event (moved_to or create) doesn't quit and terminate immediately,
it will still quit and terminate at the end of 30 seconds.

I can significantly simplify my program if I changed -t 30 to t -1,
where -1 stands for "forever". False positives aren't a problem: They
would just start another cycle. But false negatives, where a file is
created or moved into /tmp/pager but fails to quit and terminate, would
really mess me up in this particular situation.

So what do you think, is inotifywait reliable?

Thanks,

SteveT

Steve Litt 

Autumn 2023 featured book: Rapid Learning for the 21st Century
http://www.troubleshooters.com/rl21



More information about the conspire mailing list