2018-06-26

inotifywait.sh文件监控,防止服务器被黑


inotifywait.sh 文件监控

yum install -y inotify-tools
#!/bin/bash
inotifywait -mrq -e modify,create,move,delete,attrib --exclude ^.+\.[^php]$ --fromfile '/home/file-list' --timefmt '%Y/%m/%d %H:%M' --format '%T %w%f %e' >> /home/log/file.log
chmod u+x /root/inotifywait.sh
开机启动:echo "nohup /root/inotifywait.sh &" >> /etc/rc.d/rc.local
直接后台运行:nohup /root/inotifywait.sh &
nohup inotifywait -mrq -e modify,create,move,delete,attrib --exclude ^.+\.[^php]$ --fromfile '/home/file-list' --timefmt '%Y/%m/%d %H:%M' --format '%T %w%f %e' >> /home/log/file.log &