tags:

views:

34

answers:

2

I want to be able to ftp a file to a specific folder on a server and have that server run a script when it detects the new file. Any suggestions?

I tried some stuff with diff and a cron job every minute, but I couldn't quite get the results I wanted.

Any input would be appreciated!

+6  A: 

The inotify(7) facilities in Linux provide "let me know me when this changes" functions.

msw
This got me to the correct place. I installed inotify-tools, which includes inotifywait. This looks like exactly what I need. Thanks!
Trevor
Just be a little careful that you wait until ftp has finished writing the file, and don't end up trying to process half a file....
Tony
+3  A: 

Here is a good intro on how exactly to do it. You'll need a C compiler and some basic programming skills. As msw said, it is based on the iNotify subsystem from the kernel, which enables a timely reaction on modifications to a directory tree.

jdehaan
+1 IBM makes great Linux docs
msw
Your link is very good also, at the time I posted mine, it was not there. So I thought to provide some value adding. +1 for your answer too :-)
jdehaan