Ben's notes

Linux, Unix, network, radio...

User Tools

Site Tools


inotify

This is an old revision of the document!


~~TOC~~

inotify - notice inode changes

  • Install inotify:
    yum install inotify-tools
  • Watch a directory recursive:
    inotifywatch -r /opt/bacula/
  • Run your program and after that ctr-c inotifywatch:
    # inotifywatch -r /opt/bacula/
    Establishing watches...
    Finished establishing watches, now collecting statistics.
    ^Ctotal  access  modify  close_write  close_nowrite  open  create  delete  filename
    19     7       0       0            5              7     0       0       /opt/bacula/lib/
    17     2       7       2            0              2     2       2       /opt/bacula/working/
    9      4       0       0            2              3     0       0       /opt/bacula/sbin/
    9      3       0       0            3              3     0       0       /opt/bacula/etc/
    6      2       0       0            2              2     0       0       /opt/bacula/scripts/
    3      0       1       1            0              1     0       0       /opt/bacula/log/
  • Show events as they occur:
     inotifywait  -m -r /opt/bacula/
    /opt/bacula/lib/ CLOSE_NOWRITE,CLOSE libbacsql-7.0.5.so
    /opt/bacula/lib/ CLOSE_NOWRITE,CLOSE libbaccats-mysql-7.0.5.so
    /opt/bacula/sbin/ CLOSE_NOWRITE,CLOSE dbcheck
    /opt/bacula/etc/ CLOSE_NOWRITE,CLOSE bacula-dir.conf
    /opt/bacula/working/ MODIFY backup.home.polaire.nl-dir.conmsg
    /opt/bacula/working/ MODIFY backup.home.polaire.nl-dir.conmsg
    /opt/bacula/working/ MODIFY backup.home.polaire.nl-dir.conmsg
    /opt/bacula/sbin/ OPEN bsmtp
    /opt/bacula/working/ MODIFY backup.home.polaire.nl-dir.BackupCatalog.2014-12-08_10.25.33_04.-738105464.mail
    /opt/bacula/working/ ACCESS backup.home.polaire.nl-dir.BackupCatalog.2014-12-08_10.25.33_04.-738105464.mail
    /opt/bacula/sbin/ ACCESS bsmtp
    /opt/bacula/lib/ OPEN libbac-7.0.5.so
    /opt/bacula/lib/ ACCESS libbac-7.0.5.so
    /opt/bacula/lib/ CLOSE_NOWRITE,CLOSE libbac-7.0.5.so
    /opt/bacula/sbin/ CLOSE_NOWRITE,CLOSE bsmtp
    /opt/bacula/working/ CLOSE_WRITE,CLOSE backup.home.polaire.nl-dir.BackupCatalog.2014-12-08_10.25.33_04.-738105464.mail
    /opt/bacula/working/ DELETE backup.home.polaire.nl-dir.BackupCatalog.2014-12-08_10.25.33_04.-738105464.mail
    /opt/bacula/log/ MODIFY bacula.log
    /opt/bacula/log/ CLOSE_WRITE,CLOSE bacula.log
    /opt/bacula/working/ DELETE bacula-dir.9101.state
    /opt/bacula/working/ CREATE bacula-dir.9101.state
    /opt/bacula/working/ OPEN bacula-dir.9101.state
    /opt/bacula/working/ MODIFY bacula-dir.9101.state
    /opt/bacula/working/ MODIFY bacula-dir.9101.state
    /opt/bacula/working/ CLOSE_WRITE,CLOSE bacula-dir.9101.state
    /opt/bacula/working/ ACCESS backup.home.polaire.nl-dir.conmsg
    /opt/bacula/working/ MODIFY backup.home.polaire.nl-dir.conmsg
    ^C
inotify.1418030787.txt.gz · Last modified: 2014/12/08 09:26 (external edit)