I am trying to make a script to monitor a directory of the EC2 webserver I am managing. I found inotify and tried to make the following script but upon trying it nothing happened.


while inotifywait --monitor --recursive --event create --event delete /var/www/usrfiles; do

    echo "Files on the server have changed." | mail -s "server change" email@emailaddress.com



  • Just as a reference making the following changes made this runnable but like EEAA said better ways are to be found. while :; inotifywait (no --monitor) [options]; do; -- email; -- done
    – mrhobbeys
    Mar 8 '13 at 0:58

You want incron. It takes care of this sort of thing in a much easier, more reliable fashion than trying to hack things together yourself.


  • I am marking this answered because I used this for a while with success before altering the entire implementation. This, incron, works very well.
    – mrhobbeys
    May 7 '13 at 21:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.