Gamin the File Alteration Monitor


Main Menu
Related links

By default gamin should work without needing any configuration, but sometimes using the kernel notification APIs doesn't work or lead to troubles (for example when trying to unmount device). By default gamin revert to using polling for all paths matching /mnt/* or /media/* on Linux. This may be overriden or extended by the one of the three config files /etc/gamin/gaminrc, $HOME/.gaminrc, /etc/gamin/mandatory_gaminrc (note that prior to 0.1.4 only $HOME/.gaminrc was used and fsset was not implemented). Here is an example of such a configuration file:

# configuration for gamin
# Can be used to override the default behaviour.
# notify filepath(s) : indicate to use kernel notification
# poll filepath(s)   : indicate to use polling instead
# fsset fsname method poll_limit : indicate what method of notification for the filesystem
#                                  kernel - use the kernel for notification
#                                  poll - use polling for notification
#                                  none - don't use any notification
#                                  the poll_limit is the number of seconds
#                                  that must pass before a resource is polled again.
#                                  It is optional, and if it is not present the previous
#                                  value will be used or the default.
notify /mnt/local* /mnt/pictures* # use kernel notification on these paths
poll /temp/*                      # use poll notification on these paths
fsset nfs poll 10                 # use polling on nfs mounts and poll once every 10 seconds

The configuration file accepts only 3 types of command:

  • notify : to express that kernel monitoring should be used for matching paths
  • poll: to express that polling should be used for matching paths
  • fsset: to control what notification method is used on a filesystem type

The three config files are loaded in this order:

  • /etc/gamin/gaminrc
  • ~/.gaminrc
  • /etc/gamin/mandatory_gaminrc

The mandatory config file allows the system administrator to override any potentially dangerous preferences set by the user.

When checking a path to guess whether polling or kernel notification should be used, gamin checks first the user provided rules in their declaration order within the configuration file and then check the predefined rules. This way the first declaration for /mnt/local* in the example override the default one for /mnt/* .

If gamin is not told to use poll on a particular path, it will then try and decide based on the filesystem the path is located on

Caveat: separators in the config file should be spaces, not tabs.

Daniel Veillard