2020-12-09-Linux监控指定目录下的文件变化
yum install epel-release -y yum install inotify-tools -y vi monitor_dircharge.sh #!/bin/sh ## ------------------------------------------------- ## @监控目录状态,有变化后触发授权指令 ## ------------------------------------------------- srcdir="xxx" /usr/bin/inotifywait -mrq --timefmt '%d/%m/%y-%H:%M' --format '%T%w%f' -e modify,delete,create,attrib,move ${srcdir} \ | while read file do sudo chmod -R 755 ${srcdir} done chmod 755 /dir #后台运行 ./monitor_dircharge.sh & 参考链接: https://www.cnblogs.com/fjping0606/p/6114123.html 来源: oschina 链接: https://my.oschina.net/u/4383141/blog/4784803