rsync+inotify逐一文件监听并实时同步-附完美案例

来源:互联网 发布:淘宝店代销怎么样 编辑:程序博客网 时间:2024/06/05 03:57


rsync同步流程-未完待续

环境:centos6.5

软件:rsync-3.1.2.tar

用winscp上传到我们的服务器【212】上  /home/ftp/rsync 下

cd /home/ftp/rsync/

tar zxvf rsync-3.1.2.tar

cd rsync-3.1.2

./configure –prefix=/usr/local/rsync   设置安装目录

make && make install

然后就安装成功

配置rsync-server

配置参数

vi /usr/local/rsync/rsyncd.conf  //路径可以选择自己经常用的路径

###start###

port=873
motd file=/usr/local/rsync/rsyncd.motd
log file=/usr/log/rsyncd.log
pid file=/var/run/rsyncd.pid

###模块参数###
[csdn]
path=/home/csdn/test  //这个文件路径的所属用户及用户组为csdn csdn
use chroot=true
uid=csdn
git=csdn
read only=no
hosts allow = 10.0.0.0/24
hosts deny = 0.0.0.0/32
exclude=readme.txt /runtime
auth users=csdn
secrets file=/usr/local/rsync/rsyncd.secrets

###end###

配置完成后 发现没有csdn 这个用户

这时就需要创建用户了

创建用户组 groupadd -g 1818 csdn

创建用户并加入用户组 useradd -m -s /bin/bash -g 1818 -u 1818 csdn”

-m”表示要为csdn用户创建home目录,即/home/csdn/

为csdn创建.ssh 目录

mkdir /home/csdn/.ssh

改变.ssh 的所属人

shown csdn:csdn /home/csdn/.ssh

【远端其他服务器213 start】创建 csdn用户的 ssh

ssh-keygen

Generating public/private rsa key pair.

Enter file in which to save the key (/root/.ssh/id_rsa): /usr/csdn/rsync_id_rsa    注意这里的路径 默认不填写则很可能会和 root用户的ssh冲突

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /usr/rsync_id_rsa.

Your public key has been saved in /usr/rsync_id_rsa.pub.

将生成好的公钥【/usr/rsync/rsync_id_rsa.pub】上传到rsync的【服务器212】上

【远端其他服务器213 end】

【服务器212 start】

将传送过来的公钥导入 csdn 的authorized_key中

cd /home/csdn/.ssh

cat rsync_id_rsa.pub > authorized_keys

chown csdn:csdn authorized_keys

【服务器212 end】

做完配置后这时需要启动了

/usr/local/rsync/bin/rsync –daemon –config=/usr/local/rsync/rsync.conf

关闭 用 ps aux | gerp rsync 或者 /var/run/rsync.pid 查看运行ID

kill -9 ID 结束程序
[csdn@fuxuan001 mobile]$ netstat -tnl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:873 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:9001 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:6379 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:4430 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN

可以看到 873已经开启了

至此可以做下测试了(如下)

rsync -r -e “ssh -i /usr/csdn/rsync_id_rsa” csdn@172.18.67.212:/home/csdn/test
列出212服务器上 /home/csdn/test目录下的所有文件列表
rsync -avz -e “ssh -i /usr/csdn/rsync_id_rsa” /home/test/ csdn@172.18.67.212:/home/csdn/test
把本地 /home/test/ 下的文件发送到 212服务器的 /home/csdn/test/目录下

rsync -avz –delete -e “ssh -i /usr/csdn/rsync_id_rsa” /home/test/ csdn@172.18.67.212:/home/csdn/test

注意删除时本地路径要选择文件夹 如果是指定了文件则会出现 no such file 错误

做完这个rsync我们就可以手动同步数据了(做了好多增删改的测试,都可以没问题)

下边就开始 inotify 自动化的 同步数据了

忘了安装流程了回来补下:

inotify-tools-3.14.tar

下载下来 /home/ftp/inotify 目录下

tar -zxvf inotify-tools-3.14.tar

./configure –prefix=/usr/local/inotify

make && make install

安装成功  则如下 结果
[root@fuxuan001 ~]# ls /usr/local/inotify/
bin include lib share

我们以后将会用到 /usr/local/inotify/inotifywatch  这个 命令来进行 文件监听

根据上边增加修改 和删除 的 语句我们要开始规划 怎么样才可以做到最快最好的同步

思路:inotify 监听 文件的动态  获取文件的 路径(STR_PATH) 和名字(STR_NAME) 及 操作 (STR_EVENT)

有了这三个值 那我们就好办多了 直接开写 shell (我从来没写过shell 实话)

百度了一下语法然后写出了下边这个


#!/bin/bash
nu=1
/usr/local/inotify/bin/inotifywait -mrq –exclude “(.*~|.swp|.swx|.inc|.svn|.rar|.tar.gz)” -e close_write,create,move,delete –fromfile ‘/opt/scripts/ffuxuan’ –timefmt ‘%y-%m-%d %H:%M’ –format ‘%e %w %f’ | while read event
do
STR_EVENT=$(echo $event | awk ‘{print $1}’)
STR_PATH=$(echo $event | awk ‘{print $2}’)
STR_NAME=$(echo $event | awk ‘{print $3}’)
echo $STR_EVENT
#STR_FILE_NAME = $(echo $event | awk ‘{print $3}’)
#STR_FILE_PATH = $(echo $event | awk ‘{print $2}’)
if [[ $STR_EVENT =~ ‘CREATE’ ]] && [[ $STR_NAME != ‘4913’ ]]
then
echo $nu
let “nu++”
echo $event >>/tmp/rsync.log
rsync -avz -e “ssh -i /usr/csdn/rsync_id_rsa” “$STR_PATH$STR_NAME” csdn@172.18.67.213:${STR_PATH}
echo ‘—————-‘
fi
if [[ $STR_EVENT =~ ‘DELETE’ ]] || [[ $STR_EVENT =~ ‘MOVED_FROM’ ]]
then
rsync -avz –delete -e “ssh -i /usr/csdn/rsync_id_rsa” “$STR_PATH” csdn@172.18.67.213:${STR_PATH}
fi
done


提示 使用 nohup /opt/scripts/fuxuan.sh &  这种格式 可以在后台运行

刚开始 我们需要看到结果 就不用了 直接运行

其中ffxuan 文件中 内容如下(即指定需要监听的目录)


/usr/local/apache2/htdocs/data/upload/
@/usr/local/apache2/htdocs/data/upload/cache


这时候我们用  csdn用户在 这个目录下 增加修改文件 然后再 另一台服务器里查看是否同步过来

流程如下


bash-4.1$ ls   (2号服务器)
05157836212505940.png aaa.html category special
05235499664533592.png ad index.html

[csdn@fuxuan001 mobile]$ ls  (1号服务器)
05157836212505940.png aaa.html category special
05235499664533592.png ad index.html

我们在 2号上 vi test.html    加入 666
bash-4.1$ vi test.html
bash-4.1$ cat test.html
666
bash-4.1$

这时 再 看 1号服务器

[csdn@fuxuan001 mobile]$ ls
05157836212505940.png aaa.html category special
05235499664533592.png ad index.html test.html
[csdn@fuxuan001 mobile]$

已经有了 test.html
[csdn@fuxuan001 mobile]$ cat test.html
666
[csdn@fuxuan001 mobile]$

看 test.html 的内容也随之变化了

至此说明成功了(就可以配置另外一台了)

注意(/usr/local/inotify/bin/inotifywait -mrq –exclude “(.*~|.swp|.swx|.inc|.svn|.rar|.tar.gz)” -e close_write,create,move,delete –fromfile ‘/opt/scripts/ffuxuan’ –timefmt ‘%y-%m-%d %H:%M’ –format ‘%e %w %f’ | while read event)这句话 非常重要

-mrq  (基础条件了不用多说)

-m 或 –monitor 持续保持监听(如果不加此选项,则监听到一次后便退出)

-r 或 –recursive 递归监听其下所有子目录及文件

-q 或 –quiet 打印较少信息(仅打印事件)

–exclude (重要的过滤条件)

当你在使用vi 编辑 某个文件时 你会发现 监听事件突然增多了

先是会create 一个 4913文件 然后编辑 然后删除

再create 一个 swp文件 编辑然后删除

有的还有 swx 和 ~文件

所以这时候我们需要加过滤条件(加完条件后 事件会从原来的 vi 一文件产生14个事件降低到1个事件可以说是提高了N多倍效率)

–format (重要的过滤条件)’%e %w %f’  分别是 事件 路径 和文件名 

其他的都不重要就不讲解了

再往下的 if 条件句 一定要注意 shell 的字符串比较  写法 是很严格的  空格空格空格 一定要加 (我就是不知道 语法 浪费了很多时间 在这个条件句上的)

附:

【常用选项】:
-h 或 –help 显示帮助

@<file> Exclude the specified file from being watched.

–exclude <pattern> 指定排除(忽略)部分文件或目录,这些文件或目录上不监听任何事件,正则表达式书写(相对路径)
FMT: # –exclude ‘Runtime’ //忽略对Runtime目录的事件监听

–excludei <pattern> 与–exclude相同,区别是此选项正则表达式忽略大小写

-m 或 –monitor 持续保持监听(如果不加此选项,则监听到一次后便退出)

-d 或 –daemon 以守护进程方式后台运行(除了在后台运行外,与-m选项一样)

-r 或 –recursive 递归监听其下所有子目录及文件

–fromfile <file> Read files to watch from <file> or `-‘ for stdin.

-o 或 –outfile <file> 将事件输出到指定文件,而不输出到屏幕
FMT: -o /var/log/inotifywait.log

-s 或 –syslog 将错误发送到系统日志,而不是输出到屏幕

-q 或 –quiet 打印较少信息(仅打印事件)

-qq 不打印任何信息(静默方式)

–format <fmt> 设置打印屏幕的格式,常见选项:%T时间;%w触发事件文件所在绝对路径;%f触发事件文件名称;%e触发的事件名称;
FMT: # –format ‘%T %f %e’

–timefmt <fmt> 指定输出时间内容,相当于将时间赋值给%T
FMT: # –timefmt ‘%y-%m-%d %H:%M’

-c 或 –csv 用CSV格式打印事件

-t 或 –timeout <seconds> 指定一次性监听时间,超时退出监听(值为0表示永不超时,单位:秒),不可与 -m -d 连用
FMT: # -t 60 //设定监听60秒,60秒内监听到事件立即退出,如果监听不到事件60秒后也退出

-e 或 –event <event1> [ -e|–event <event2> … ] 指定要监听的事件(多个事件用逗号分割)
FMT: # -e ‘create,delete,close_write,attrib,moved_to’

【总结提示】:

Exit status: 退出返回状态值
0 – An event you asked to watch for was received.
正常收到监听事件

1 – An event you did not ask to watch for was received (usually delete_self or unmount), or some error occurred.
意外收到一个未监听的事件(如:文件自删除,umount及其它情况)

2 – The –timeout option was given and no events occurred in the specified interval of time.
当给定了超时选项,设定时间内没有事件产生

Events: 事件
access        file or directory contents were read 文件或目录被(访问)读取r
modify        file or directory contents were written 文件或目录被写入w
attrib        file or directory attributes changed 文件或目录属性变更【理由:chmod更改属性】
close_write   file or directory closed, after being opened in writeable mode 文件或目录被写关闭【理由:文件内容被更改】
close_nowrite file or directory closed, after being opened in read-only mode 文件或目录以只读方式打开后关闭
close         file or directory closed, regardless of read/write mode 文件或目录被用编辑器(不管是读或写)关闭
open          file or directory opened 文件或目录被用编辑器打开
moved_to      file or directory moved to watched directory 文件或目录被移动进来【理由:mv目录内重命名】
moved_from    file or directory moved from watched directory 文件或目录被移动出去
move          file or directory moved to or from watched directory 文件或目录不管是移出或移进
create        file or directory created within watched directory 文件或目录被创建【理由:mkdir创建目录】
delete        file or directory deleted within watched directory 文件或目录被删除【理由:rm删除】
delete_self   file or directory was deleted 文件或目录自删除
unmount       file system containing file or directory unmounted 文件系统取消挂载

 

转载请注明原出处 谢谢

神秘剑派–大师兄                  zxc 秒杀技能

rsync同步流程-未完待续

环境:centos6.5

软件:rsync-3.1.2.tar

用winscp上传到我们的服务器【212】上  /home/ftp/rsync 下

cd /home/ftp/rsync/

tar zxvf rsync-3.1.2.tar

cd rsync-3.1.2

./configure –prefix=/usr/local/rsync   设置安装目录

make && make install

然后就安装成功

配置rsync-server

配置参数

vi /usr/local/rsync/rsyncd.conf  //路径可以选择自己经常用的路径

###start###

port=873
motd file=/usr/local/rsync/rsyncd.motd
log file=/usr/log/rsyncd.log
pid file=/var/run/rsyncd.pid

###模块参数###
[csdn]
path=/home/csdn/test  //这个文件路径的所属用户及用户组为csdn csdn
use chroot=true
uid=csdn
git=csdn
read only=no
hosts allow = 10.0.0.0/24
hosts deny = 0.0.0.0/32
exclude=readme.txt /runtime
auth users=csdn
secrets file=/usr/local/rsync/rsyncd.secrets

###end###

配置完成后 发现没有csdn 这个用户

这时就需要创建用户了

创建用户组 groupadd -g 1818 csdn

创建用户并加入用户组 useradd -m -s /bin/bash -g 1818 -u 1818 csdn”

-m”表示要为csdn用户创建home目录,即/home/csdn/

为csdn创建.ssh 目录

mkdir /home/csdn/.ssh

改变.ssh 的所属人

shown csdn:csdn /home/csdn/.ssh

【远端其他服务器213 start】创建 csdn用户的 ssh

ssh-keygen

Generating public/private rsa key pair.

Enter file in which to save the key (/root/.ssh/id_rsa): /usr/csdn/rsync_id_rsa    注意这里的路径 默认不填写则很可能会和 root用户的ssh冲突

Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /usr/rsync_id_rsa.

Your public key has been saved in /usr/rsync_id_rsa.pub.

将生成好的公钥【/usr/rsync/rsync_id_rsa.pub】上传到rsync的【服务器212】上

【远端其他服务器213 end】

【服务器212 start】

将传送过来的公钥导入 csdn 的authorized_key中

cd /home/csdn/.ssh

cat rsync_id_rsa.pub > authorized_keys

chown csdn:csdn authorized_keys

【服务器212 end】

做完配置后这时需要启动了

/usr/local/rsync/bin/rsync –daemon –config=/usr/local/rsync/rsync.conf

关闭 用 ps aux | gerp rsync 或者 /var/run/rsync.pid 查看运行ID

kill -9 ID 结束程序
[csdn@fuxuan001 mobile]$ netstat -tnl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:873 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:9001 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:6379 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:4430 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN

可以看到 873已经开启了

至此可以做下测试了(如下)

rsync -r -e “ssh -i /usr/csdn/rsync_id_rsa” csdn@172.18.67.212:/home/csdn/test
列出212服务器上 /home/csdn/test目录下的所有文件列表
rsync -avz -e “ssh -i /usr/csdn/rsync_id_rsa” /home/test/ csdn@172.18.67.212:/home/csdn/test
把本地 /home/test/ 下的文件发送到 212服务器的 /home/csdn/test/目录下

rsync -avz –delete -e “ssh -i /usr/csdn/rsync_id_rsa” /home/test/ csdn@172.18.67.212:/home/csdn/test

注意删除时本地路径要选择文件夹 如果是指定了文件则会出现 no such file 错误

做完这个rsync我们就可以手动同步数据了(做了好多增删改的测试,都可以没问题)

下边就开始 inotify 自动化的 同步数据了

忘了安装流程了回来补下:

inotify-tools-3.14.tar

下载下来 /home/ftp/inotify 目录下

tar -zxvf inotify-tools-3.14.tar

./configure –prefix=/usr/local/inotify

make && make install

安装成功  则如下 结果
[root@fuxuan001 ~]# ls /usr/local/inotify/
bin include lib share

我们以后将会用到 /usr/local/inotify/inotifywatch  这个 命令来进行 文件监听

根据上边增加修改 和删除 的 语句我们要开始规划 怎么样才可以做到最快最好的同步

思路:inotify 监听 文件的动态  获取文件的 路径(STR_PATH) 和名字(STR_NAME) 及 操作 (STR_EVENT)

有了这三个值 那我们就好办多了 直接开写 shell (我从来没写过shell 实话)

百度了一下语法然后写出了下边这个


#!/bin/bash
nu=1
/usr/local/inotify/bin/inotifywait -mrq –exclude “(.*~|.swp|.swx|.inc|.svn|.rar|.tar.gz)” -e close_write,create,move,delete –fromfile ‘/opt/scripts/ffuxuan’ –timefmt ‘%y-%m-%d %H:%M’ –format ‘%e %w %f’ | while read event
do
STR_EVENT=$(echo $event | awk ‘{print $1}’)
STR_PATH=$(echo $event | awk ‘{print $2}’)
STR_NAME=$(echo $event | awk ‘{print $3}’)
echo $STR_EVENT
#STR_FILE_NAME = $(echo $event | awk ‘{print $3}’)
#STR_FILE_PATH = $(echo $event | awk ‘{print $2}’)
if [[ $STR_EVENT =~ ‘CREATE’ ]] && [[ $STR_NAME != ‘4913’ ]]
then
echo $nu
let “nu++”
echo $event >>/tmp/rsync.log
rsync -avz -e “ssh -i /usr/csdn/rsync_id_rsa” “$STR_PATH$STR_NAME” csdn@172.18.67.213:${STR_PATH}
echo ‘—————-‘
fi
if [[ $STR_EVENT =~ ‘DELETE’ ]] || [[ $STR_EVENT =~ ‘MOVED_FROM’ ]]
then
rsync -avz –delete -e “ssh -i /usr/csdn/rsync_id_rsa” “$STR_PATH” csdn@172.18.67.213:${STR_PATH}
fi
done


提示 使用 nohup /opt/scripts/fuxuan.sh &  这种格式 可以在后台运行

刚开始 我们需要看到结果 就不用了 直接运行

其中ffxuan 文件中 内容如下(即指定需要监听的目录)


/usr/local/apache2/htdocs/data/upload/
@/usr/local/apache2/htdocs/data/upload/cache


这时候我们用  csdn用户在 这个目录下 增加修改文件 然后再 另一台服务器里查看是否同步过来

流程如下


bash-4.1$ ls   (2号服务器)
05157836212505940.png aaa.html category special
05235499664533592.png ad index.html

[csdn@fuxuan001 mobile]$ ls  (1号服务器)
05157836212505940.png aaa.html category special
05235499664533592.png ad index.html

我们在 2号上 vi test.html    加入 666
bash-4.1$ vi test.html
bash-4.1$ cat test.html
666
bash-4.1$

这时 再 看 1号服务器

[csdn@fuxuan001 mobile]$ ls
05157836212505940.png aaa.html category special
05235499664533592.png ad index.html test.html
[csdn@fuxuan001 mobile]$

已经有了 test.html
[csdn@fuxuan001 mobile]$ cat test.html
666
[csdn@fuxuan001 mobile]$

看 test.html 的内容也随之变化了

至此说明成功了(就可以配置另外一台了)

注意(/usr/local/inotify/bin/inotifywait -mrq –exclude “(.*~|.swp|.swx|.inc|.svn|.rar|.tar.gz)” -e close_write,create,move,delete –fromfile ‘/opt/scripts/ffuxuan’ –timefmt ‘%y-%m-%d %H:%M’ –format ‘%e %w %f’ | while read event)这句话 非常重要

-mrq  (基础条件了不用多说)

-m 或 –monitor 持续保持监听(如果不加此选项,则监听到一次后便退出)

-r 或 –recursive 递归监听其下所有子目录及文件

-q 或 –quiet 打印较少信息(仅打印事件)

–exclude (重要的过滤条件)

当你在使用vi 编辑 某个文件时 你会发现 监听事件突然增多了

先是会create 一个 4913文件 然后编辑 然后删除

再create 一个 swp文件 编辑然后删除

有的还有 swx 和 ~文件

所以这时候我们需要加过滤条件(加完条件后 事件会从原来的 vi 一文件产生14个事件降低到1个事件可以说是提高了N多倍效率)

–format (重要的过滤条件)’%e %w %f’  分别是 事件 路径 和文件名 

其他的都不重要就不讲解了

再往下的 if 条件句 一定要注意 shell 的字符串比较  写法 是很严格的  空格空格空格 一定要加 (我就是不知道 语法 浪费了很多时间 在这个条件句上的)

附:

【常用选项】:
-h 或 –help 显示帮助

@<file> Exclude the specified file from being watched.

–exclude <pattern> 指定排除(忽略)部分文件或目录,这些文件或目录上不监听任何事件,正则表达式书写(相对路径)
FMT: # –exclude ‘Runtime’ //忽略对Runtime目录的事件监听

–excludei <pattern> 与–exclude相同,区别是此选项正则表达式忽略大小写

-m 或 –monitor 持续保持监听(如果不加此选项,则监听到一次后便退出)

-d 或 –daemon 以守护进程方式后台运行(除了在后台运行外,与-m选项一样)

-r 或 –recursive 递归监听其下所有子目录及文件

–fromfile <file> Read files to watch from <file> or `-‘ for stdin.

-o 或 –outfile <file> 将事件输出到指定文件,而不输出到屏幕
FMT: -o /var/log/inotifywait.log

-s 或 –syslog 将错误发送到系统日志,而不是输出到屏幕

-q 或 –quiet 打印较少信息(仅打印事件)

-qq 不打印任何信息(静默方式)

–format <fmt> 设置打印屏幕的格式,常见选项:%T时间;%w触发事件文件所在绝对路径;%f触发事件文件名称;%e触发的事件名称;
FMT: # –format ‘%T %f %e’

–timefmt <fmt> 指定输出时间内容,相当于将时间赋值给%T
FMT: # –timefmt ‘%y-%m-%d %H:%M’

-c 或 –csv 用CSV格式打印事件

-t 或 –timeout <seconds> 指定一次性监听时间,超时退出监听(值为0表示永不超时,单位:秒),不可与 -m -d 连用
FMT: # -t 60 //设定监听60秒,60秒内监听到事件立即退出,如果监听不到事件60秒后也退出

-e 或 –event <event1> [ -e|–event <event2> … ] 指定要监听的事件(多个事件用逗号分割)
FMT: # -e ‘create,delete,close_write,attrib,moved_to’

【总结提示】:

Exit status: 退出返回状态值
0 – An event you asked to watch for was received.
正常收到监听事件

1 – An event you did not ask to watch for was received (usually delete_self or unmount), or some error occurred.
意外收到一个未监听的事件(如:文件自删除,umount及其它情况)

2 – The –timeout option was given and no events occurred in the specified interval of time.
当给定了超时选项,设定时间内没有事件产生

Events: 事件
access        file or directory contents were read 文件或目录被(访问)读取r
modify        file or directory contents were written 文件或目录被写入w
attrib        file or directory attributes changed 文件或目录属性变更【理由:chmod更改属性】
close_write   file or directory closed, after being opened in writeable mode 文件或目录被写关闭【理由:文件内容被更改】
close_nowrite file or directory closed, after being opened in read-only mode 文件或目录以只读方式打开后关闭
close         file or directory closed, regardless of read/write mode 文件或目录被用编辑器(不管是读或写)关闭
open          file or directory opened 文件或目录被用编辑器打开
moved_to      file or directory moved to watched directory 文件或目录被移动进来【理由:mv目录内重命名】
moved_from    file or directory moved from watched directory 文件或目录被移动出去
move          file or directory moved to or from watched directory 文件或目录不管是移出或移进
create        file or directory created within watched directory 文件或目录被创建【理由:mkdir创建目录】
delete        file or directory deleted within watched directory 文件或目录被删除【理由:rm删除】
delete_self   file or directory was deleted 文件或目录自删除
unmount       file system containing file or directory unmounted 文件系统取消挂载

 

转载请注明原出处 谢谢

神秘剑派–大师兄                  zxc 秒杀技能

阅读全文
0 0
原创粉丝点击