[TriLUG] How reliable is inotifywait?

Ken VanDine via TriLUG trilug at trilug.org
Sun Mar 10 18:41:53 EDT 2024


In my experience it's very reliable.  We use it in Ubuntu to determine when
the display server is up before starting the installer.

https://github.com/canonical/ubuntu-core-desktop-installer/blob/00cb18b0b2512bb81986c6259d5561fc5a9e3976/launcher/launcher#L57

Cheers,
Ken


On Sun, Mar 10, 2024, 6:09 PM Steve Litt via TriLUG <trilug at trilug.org>
wrote:

> 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
> --
> This message was sent to: Ken VanDine <ken at vandine.org>
> To unsubscribe, send a blank message to trilug-leave at trilug.org from that
> address.
> TriLUG mailing list : https://www.trilug.org/mailman/listinfo/trilug
> Unsubscribe or edit options on the web  :
> https://www.trilug.org/mailman/options/trilug/ken%40vandine.org
> Welcome to TriLUG: https://trilug.org/welcome


More information about the TriLUG mailing list