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 have a process where users ftp particular files to /home/ftp/file1.txt & /home/ftp/file2.txt any given time of the day. I setup incrontab with the following:

/home/ftp/file1.txt IN_CLOSE_WRITE myCustomCMD
/home/ftp/file2.txt IN_CLOSE_WRITE myCustomCMD

I've been playing around with the different events to get the best result. I don't want a user to open the file in vim just to read and have it process the file again.

Any suggestions on the best practice to watch a file for any updates and then process the file? I tried IN_MODIFY but that doesn't trigger my command every time. I had IN_ALL_EVENTS but that failed to trigger as well.

PS: I would have tagged this with incrontab & incrond but they don't exist yet. My noob status won't let me create new tags. :(

share|improve this question

It sounds like you haven't started the incrond service. Did you take a look at /var/log/cron while testing?

share|improve this answer
It's triggering like it should on IN_CLOSE_WRITE. It wasn't all the time with IN_MODIFY or IN_ALL_EVENTS event. It would execute if I copied the file from another location on the box to the filename in the incrontab with those 2 events. – KinGBin Oct 20 '11 at 21:24

If you are free to change the FTP daemon used I wholeheartedly recommend pure-ftpd.

It directly supports a script invoked on upload (and no other events); this script can then take any actions you deem necessary, and is run under the user performing the upload.

share|improve this answer
I'll have to check it out. I was using vsftpd so I could easily jail the ftp user. I see pure-ftpd allows chroot users. – KinGBin Oct 20 '11 at 21:27

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.