Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

2 Answers 2

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: http://inotify.aiken.cz/?section=incron&page=doc&lang=en

share|improve this answer
1  
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

 
discard

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.