Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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

how can I tell incrontab to run this command when there has been any modification done under the /web directory?

/web IN_CREATE,IN_DELETE,IN_MODIFY /bin/echo "this is a test..."

share|improve this question
Just a hint: /bin/echo will not be connected to any terminal so the output goes nowhere (but you will get a info line that the action ran in the syslog). – Sven Feb 6 '12 at 13:44
+1 Your syntax looks right. Is it that you just don't see "this is a test..." displayed? – Richard Holloway Feb 6 '12 at 21:25
up vote 1 down vote accepted

Here is the incrontab record syntax taken from this page:

<directory> <file change mask> <command or action>  options

So, your command should be OK. You need to pay attention to two points:

  1. Add the needed changes in the record such as the mentioned in your question (IN_CREATE, etc...).
  2. This record will watch only the directory the files/folders under it, but not under its subfolders. It is NOT recursive. You need to include more records if you want to watch other subfolders.
share|improve this answer

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.