PDA

View Full Version : Monitor and FTP directory recursively for file uploads


dpicella
27th May 2009, 16:45
I am running a Fedora 10 Server with websites managed by ISPConfig 3.

I have an account that will be loading files in an FTP directory. I need to send notifications (email would be fine or I could run a command) when new files are uploaded in the directory tree. I thought of making scripts to do this myself, but it seems that linux may have tools already...

I ran accrosss a program called dnotify which apparently was adopted by some linux distributions for a time. I do not believe that it monitors recursively. It also seems that dnotify was replaced by and upgraded project called inotify at some point.

On my server, neither of these are installed or available through the default package manager - yum. I would have to patch my kernel to do so. I am not sure it is worth the trouble if there are better tools to get the job done.

Does anyone have any experience with this?

Cheers!

falko
28th May 2009, 12:45
This tutorial might be of interest: http://www.howtoforge.com/triggering-commands-on-file-or-directory-changes-with-incron

dpicella
28th May 2009, 18:17
Great! That is just what I was looking for.

I was able to install incron on Fedora 10 using
yum install incron

I then started the incron daemon
service incrond start

To turn on the daemon at boot
chkconfig incrond on

I was able to install a monitor for new files in a directory that sends an email notice and it works great.

There is more information about incron at:
http://www.linux.com/archive/feature/144666

The only problem I have is that it does not monitor recursively, but I can easily work around that now.

Cheers!