define-null/inotify
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
Introduction ------------ Inotify is on erlang port for the Linux inotify API allowing one to monitor changes to files and directory in the filesystem. Installation ------------ git clone https://github.com/define-null/inotify.git cd inotify make Using inotify example: ------------- Erl console: > Mask = all. > Callback = self(). > inotify_server:add_watch("/tmp/somefile", Mask, Callback). {ok,<0.73.0>} Bash: touch /tmp/somefile Erl console: > flush(). Shell got {<0.83.0>,{inotify_event,"/tmp/mu2",[open],0,[]}} Shell got {<0.83.0>,{inotify_event,"/tmp/mu2",[attrib],0,[]}} Shell got {<0.83.0>,{inotify_event,"/tmp/mu2",[close_write],0,[]}} Also add_watch_link/3 is availuable, to link with handler process. Mask is the one from http://www.kernel.org/doc/man-pages/online/pages/man7/inotify.7.html Callback could be a pid(), function(pid(), inotify_event()) and {Mod, Fun}. License ------- In short, you can do anything you want with the code including using it as part of you plan for world domination (if your successful can I have one of the nicer countries please). No responsiblity it taken for the fitness of the any purpose, etc, etc. The only thing I ask is that if you find a bug and fix send me the patch. Likewise, feature suggestions and patches are welcome. TODO ---- * Write more documentation!
Releases
No releases published
Languages
- JavaScript 78.5%
- Erlang 10.7%
- C 10.7%
- Shell 0.1%