-
Notifications
You must be signed in to change notification settings - Fork 1
Inotify
Inotify is a linux kernel subsystem that allows to listen for certain filesystem events like creating, removing or updating files/directories (for a full list see below). This plugin implements a system for monitoring directories or files from within rbot. With this plugin, you can let yourself or one or more channels notify about these events.
The plugin is using the ruby library FFI to accessing the native inotify kernel subsystem.
Make sure you have Ruby-FFI installed, for example with rubygems:
# gem install ffiYou can check if you have properly installed it with (remove the require 'rubygems' part if you don’t use rubygems):
$ ruby -e "require 'rubygems'; require 'ffi'"If you don’t get any LoadError messages the ffi library is properly installed. To install the plugin you can download it from github into your rbot plugins directory, e.g.:
$ wget -O ~/.rbot/plugins/inotify.rb http://github.com/4poc/rbot-plugins/raw/master/inotify.rbOr you can checkout my rbot-plugins repository to make sure you always have the newest version. I described it here: Home.
The plugin supports to listen for most of the inotify events:
- READ (IN_ACCESS)
- UPDATE (IN_MODIFY)
- ATTRIBUTE (IN_ATTRIB) (attribute change)
- MOVE (IN_MOVE)
- DELETE (IN_DELETE)
- CREATE (IN_CREATE)
Example for specifying event types: ‘create, update’, ‘create and update’, ‘CU’ (all meaning the same)
If you want to listen for the creating, deleting, moving and attribute changing of files (not directories) in /ftp/pub:
inotify watch /ftp/pub for create, delete, move and attribute of files