Laurence J. Lane wrote:
> Orphaning dnotify.
>
> Description: Execute a command when the contents of a directory change
> dnotify is a simple program based on Linux kernel 2.4.19+'s dnotify
> API. [..]
I wonder if this package should not be removed altogether:
* It does work with the current stable kernel, see #510118 (eek)
* Its functionality can be almost trivially reimplemented:
import sys
from pyinotify import WatchManager, Notifier, EventsCodes
mask = EventsCodes.IN_MODIFY | EventsCodes.IN_DELETE | \
EventsCodes.IN_ATTRIB | EventsCodes.IN_CREATE
def callback(x):
# call program here
pass
wm = WatchManager()
notifier = Notifier(wm, callback)
wm.add_watch(sys.argv[1:], mask)
while True:
try:
notifier.process_events()
if notifier.check_events(timeout=None):
notifier.read_events()
except Exception:
notifier.stop()
break
Just add a bunch of option handling and you're away.
* The whole dnotify interface has been obsoleted by inotify since 2005
Regards,
--
,''`.
: :' : Chris Lamb
`. `'` lamby@debian.org
`-
Attachment:
signature.asc
Description: PGP signature