Re: How reliable is inotifywait?

Nick Moffitt <[email protected]>
Newsgroups gmane.org.user-groups.linux.cabal
Message-ID <[email protected]>
On 10Mar2024 06:06pm (-0400), Steve Litt wrote:
> 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 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?

inotifywait uses the kernel's inotify interface, which has been around for a couple decades now.  It's *definitely* more reliable than a script polling filesystem state in a loop, and absolutely more resource-efficient.

I strongly suspect that for your use case, inotify will be one of the most reliable parts of your system.
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.