From 47b99ca17c003aeb01f879a40bd642fa4601602a Mon Sep 17 00:00:00 2001 From: chrys87 Date: Mon, 11 Jul 2016 14:52:08 +0200 Subject: [PATCH] Update TODO --- TODO | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/TODO b/TODO index d5caa92e..61d8aa08 100644 --- a/TODO +++ b/TODO @@ -13,17 +13,25 @@ class Identity(pyinotify.ProcessEvent): p = event.pathname print(p) - wm = pyinotify.WatchManager() -notifier = pyinotify.Notifier(wm, default_proc_fun=Identity()) +notifier = pyinotify.Notifier(wm, default_proc_fun=Identity(), timeout=5) wm.add_watch('/dev/vcsa1', pyinotify.ALL_EVENTS, auto_add=True) wm.add_watch('/dev/vcsa2', pyinotify.ALL_EVENTS, auto_add=True) wm.add_watch('/dev/vcsa3', pyinotify.ALL_EVENTS, auto_add=True) wm.add_watch('/dev/vcsa4', pyinotify.ALL_EVENTS, auto_add=True) wm.add_watch('/dev/vcsa5', pyinotify.ALL_EVENTS, auto_add=True) wm.add_watch('/dev/vcsa6', pyinotify.ALL_EVENTS, auto_add=True) -notifier.loop() +#notifier.loop( ) + +try: + while 1: + notifier.process_events() + if notifier.check_events(): + notifier.read_events() +except KeyboardInterrupt: + notifier.stop() + print('fin') https://www.infoq.com/articles/inotify-linux-file-system-event-monitoring https://github.com/seb-m/pyinotify/wiki/Tutorial