我试图做一个脚本来监视我正在pipe理的EC2networking服务器的目录。 我发现inotify并试图做出以下脚本,但尝试它没有发生任何事情。
#!/bin/sh while inotifywait --monitor --recursive --event create --event delete /var/www/usrfiles; do echo "Files on the server have changed." | mail -s "server change" [email protected] done
http://linux.die.net/man/1/inotifywait
你想incron。 它比以自己的方式来破解事物更容易,更可靠的方式来处理这类事情。