forked from seb-m/pyinotify
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import pyinotify | ||
from tornado.ioloop import IOLoop | ||
|
||
wm = pyinotify.WatchManager() # Watch Manager | ||
mask = pyinotify.IN_MODIFY | ||
|
||
class EventHandler(pyinotify.ProcessEvent): | ||
def process_IN_MODIFY(self, event): | ||
# We have explicitely registered for this kind of event. | ||
print '\t', event.pathname, ' -> written' | ||
def process_default(self, event): | ||
print event | ||
|
||
ioloop = IOLoop.instance() | ||
notifier = pyinotify.TornadoAsyncNotifier(wm, ioloop) | ||
#daemon.pids['nginx'] | ||
wdd = wm.watch_transient_file('/tmp/test_file', pyinotify.IN_MODIFY, EventHandler) | ||
|
||
ioloop.start() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters