Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to get alerted when a new directory or sub directory is created within the root directory that I am monitoring. The alert has to be triggered to a PHP file. How do I do this on CentOS? Is inotify the best route to take? I just need to know when a new directory is created and the location. So I am looking for the simplest of ideas to do this.

  • I have full control of the server
  • I just need to monitor creation of a directory
  • Alerts have to be sent to a PHP file (directly or indirectly)

Please send through any ideas you might have.

share|improve this question
up vote 2 down vote accepted

If you add the EPEL repo to your CentOS host there is an "incron" package available which works with inotify to do what you're looking to do. Here's the docs:

share|improve this answer
incron won't work recursively though. inotifywatch from inotify-tools will. – Dennis Williamson Jul 27 '10 at 22:51

CentOS 6.3 has inotifywait built in.

share|improve this answer
You might consider adding more detail to your answer. How long has it been in CentOS? – Jacob Mar 18 '13 at 22:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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