[Grok-dev] zopectl autorestart

Peter Bengtsson peter at fry-it.com
Mon Jun 9 12:30:35 EDT 2008


>>
>>  2. Does inotify work on the OSX? (which I care about unlike Windows)
>
> There is an OSX equivalent and it's called FSEvents [1]. It was
> introduced in Leopard (OSX 10.5), probably to support Spotlight and
> Time Machine (the search and backup apps).
>
Looked at it and decided to ditch it. It's quite complicated to work
with unlike pyinotify and doesn't work for change of files. Better for
noticing creation and destruction of files.
I guess it's because Spotlight cares mostly about the file's name and
it's presence.

>
> I bet there is a Windows equivalent as well. Anyone knows about it? Sidnei?
>
> Wrapping those services in a platform-independent way would be a
> valuable contribution to Python.
That's what Gamin set out to do but the project seems dead and the
Download page offers sources or RPMs (ubuntu package available which
works but I can't suggest compile from source).

What I'm going to do is write an plan B script that looks something like this::

try:
    import pyinotify
    print "Great!"
    ...
except ImportError:
    files = get_files_to_watch()
    mtimes = get_mtimes(files)
    while 1:
        if get_mtimes(files) != mtimes:
            restart()
        sleep(1)

If that makes any sense. I don't want people to have to worry about
how it works as long as it works and for the linux people it works
even better.


-- 
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com


More information about the Grok-dev mailing list