[TriLUG] How reliable is inotifywait?

Scott Lambdin via TriLUG trilug at trilug.org
Mon Mar 11 18:32:37 EDT 2024


Interesting.  I saw a web page called "Replacing incron with systemd."
Looks like there may be a new way to do it.  I can't get to the page,
perhaps because I am at a cigar bar in Mexico.

On Mon, Mar 11, 2024, 4:06 PM Scott Lambdin <lopaki at gmail.com> wrote:

> iNotify/incron has been around like ten years.  If you can find an active
> incron message board, that would probably be a good place to look for
> failure reports.
>
> On Sun, Mar 10, 2024, 5:24 PM James Toebes via TriLUG <trilug at trilug.org>
> wrote:
>
>> Have you checked out incron?   Similar to cron,  but runs on inodes.
>> You can easily define script that run when a file is added, deleted....
>>
>>
>> On 3/10/24 18:41, Ken VanDine via TriLUG wrote:
>> > 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
>> --
>> This message was sent to: Scott Lambdin <lopaki at gmail.com>
>> 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/lopaki%40gmail.com
>> Welcome to TriLUG: https://trilug.org/welcome
>
>


More information about the TriLUG mailing list