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'm using incron to watch for events in a directory but I want to exclude some subdirectory or some filename PATTERNS.

Is there a way I can do this elegantly?

share|improve this question
up vote 1 down vote accepted

You can't do exclusions through incrontab. You can list the files explicitly, or you can make a wrapper to filter files which you do not want to process.

A super-simple wrapper:

#!/bin/bash

if ! grep -q $1 /path/to/incron.excludes
then
    exec /path/to/realscript.sh $1
fi
share|improve this answer
    
Thank you. I also received an interesting answer on stackoverflow: stackoverflow.com/questions/6383021/… – clneagu Jul 6 '11 at 8:43

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.