How reliable is inotifywait?

Steve Litt <[email protected]>
Newsgroups gmane.org.user-groups.linux.cabal
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.