此内容没有您所选择的语言版本。

24.4.7. Monitoring Files and Directories with gamin


Starting with Red Hat Enterprise Linux 6.8, the GLib system library uses gamin for monitoring of files and directories, and detection of their modifications on NFS file systems. By default, gamin uses polling for NFS file systems instead of inotify. Changes on other file systems are monitored by the inotify monitor that is implemented in GLib directly.
As a subset of the File Alteration Monitor (FAM) system, gamin re-implements the FAM specification with the inotify Linux kernel subsystem. It is a GNOME project, but without any GNOME dependencies. Both glib2 and gamin packages are installed by default.
By default, gamin works without the need of any configuration and it reverts to using polling for all paths matching /mnt/* or /media/* on Linux. Users can override or extend these settings by modifying the content of one of the following configuration files:
  • /etc/gamin/gaminrc
  • $HOME/.gaminrc
  • /etc/gamin/mandatory_gaminrc
The configuration file accepts only the following commands:

Commands accepted by the configuration file

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.
An example of such configuration file can be seen here:
# 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 file system
#                                  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 three configuration files are loaded in this order:
  1. /etc/gamin/gaminrc
  2. ~/.gaminrc
  3. /etc/gamin/mandatory_gaminrc
The /etc/gamin/mandatory_gaminrc configuration 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 configured to use the poll notifications on a particular path, it decides based on the file system the path is located on.
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.