inotifywait 是一个可以实时监控文件变动的工具,它利用linux内核中的inotify机制实现监控功能。
安装inotify
yum install -y inotify-tools
配置监控:
inotifywait -mrq /data/tomcat/ -e 'delete,modify,move,moved_to,moved_from' --timefmt '%Y-%m-%d %H:%M' --format '%T %w%f %e' > /data/logs/inotify/tomcat.log &