版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/Gekkoou/article/details/83827227
inotify-tools项目地址: https://github.com/rvoicilas/inotify-tools
inotify-tools下载地址: http://github.com/downloads/rvoicilas/inotify-tools/inotify-tools-3.14.tar.gz
inotify-tools 安装方法: https://github.com/rvoicilas/inotify-tools/wiki
简单例子
inotifywait -mr /home --timefmt '%Y-%m-%d %H:%M:%S' --format '%T %w %f %e' -e create,modify,attrib,move,delete |
while read time path file action; do
# do your thing here
echo "$time $path $file $action" >> /test.log
done
详细参数与命令详解自行百度吧~