Courier IMAP and inotify

I have a python script that monitors a folder for changes, using inotify via the pyinotify library.

This works - any changes are refected as inotify events and reported by the script.  Mostly.  One of the folders I am monitoring is a Maildir folder with emails in it, and courier imap puts them there.

None of the file activities carried out by courier are notified by inotify.  This makes me think that courier is somehow putting the files there bypassing whatever mechanism the kernel is using inotify to monitor.

If I watch an email come into a maildir nothing appears in inotify.  If I rename that same file, an inotify event is generated.  If I copy it, an event happens.  If I delete it an event happens.  If courier does any of these things, no event is generated.

Does anyone know how I can get courier's file activities to show up as inotify events?   This is on ubuntu btw.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Duncan RoeSoftware DeveloperCommented:
Can you arrange to strace courier while it delivers a mail? It does seem very strange that it bypasses inotify. Does courier run as root or have any unusual privileges?
muffAuthor Commented:
Thanks, but I have realised it was simply me being stupid.

The filesystem was NFS - when courier was updating the files it was from another machine, and so the machine I am running inotify on had no idea.  When I was testing, I was updating from the machine inotify was running on, so of course it raised an event.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Duncan RoeSoftware DeveloperCommented:
Ok, I thought there must be a Linux IMAP servwer by now. No worries, give yourself the points.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Email Protocols

From novice to tech pro — start learning today.