第 10 章 inotify

简介:

目录

10.1. inotify-tools
10.2. Incron - cron-like daemon which handles filesystem events
10.2.1. incrontab - inotify cron table manipulator
10.2.2. 使用说明
10.2.2.1. mask 参数
10.2.2.2. command 参数
10.3. inotify-tools + rsync
10.4. pyinotify

$ ls -ld /proc/sys/fs/inotify/*

10.1. inotify-tools

Installation

ubuntu

sudo apt-get install inotify-tools
		

centos

yum install inotify-tools
		

inotifywait -r -m $HOME

监控登录过程

neo@master:~$ inotifywait -r  -m $HOME
Setting up watches.  Beware: since -r was given, this may take a while!
Watches established.
/home/neo/ OPEN .profile
/home/neo/ ACCESS .profile
/home/neo/ CLOSE_NOWRITE,CLOSE .profile
/home/neo/ OPEN .bashrc
/home/neo/ ACCESS .bashrc
/home/neo/ CLOSE_NOWRITE,CLOSE .bashrc
/home/neo/ OPEN .bash_history
/home/neo/ ACCESS .bash_history
/home/neo/ CLOSE_NOWRITE,CLOSE .bash_history
/home/neo/ OPEN .bash_history
/home/neo/ ACCESS .bash_history
/home/neo/ CLOSE_NOWRITE,CLOSE .bash_history
		

create a new file helloworld.txt

/home/neo/ CREATE helloworld.txt
/home/neo/ OPEN helloworld.txt
/home/neo/ MODIFY helloworld.txt
/home/neo/ CLOSE_WRITE,CLOSE helloworld.txt
		

cat a file using cat helloworld.txt

/home/neo/ OPEN,ISDIR
/home/neo/ CLOSE_NOWRITE,CLOSE,ISDIR
/home/neo/ OPEN,ISDIR
/home/neo/ CLOSE_NOWRITE,CLOSE,ISDIR
/home/neo/ OPEN helloworld.txt
/home/neo/ ACCESS helloworld.txt
/home/neo/ CLOSE_NOWRITE,CLOSE helloworld.txt
		

delete a file helloworld.txt

/home/neo/ OPEN,ISDIR
/home/neo/ CLOSE_NOWRITE,CLOSE,ISDIR
/home/neo/ OPEN,ISDIR
/home/neo/ CLOSE_NOWRITE,CLOSE,ISDIR
/home/neo/ DELETE helloworld.txt
		




原文出处:Netkiller 系列 手札
本文作者:陈景峯
转载请与作者联系,同时请务必标明文章原始出处和作者信息及本声明。

目录
相关文章
|
监控 Ubuntu Linux
|
网络协议 Ubuntu Shell
|
监控 Linux Shell
|
网络协议 Linux Shell
|
监控 Linux 数据安全/隐私保护
|
网络协议 开发工具 Perl