검색

이 콘텐츠는 선택한 언어로 제공되지 않습니다.

24.4.7. Monitoring Files and Directories with gamin

download PDF
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

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

© 2024 Red Hat, Inc.