Trigger on file/directory

download the package and install it.
http://wiki.github.com/rvoicilas/inotify-tools/

./configure
make
make install

Reload all librairies :

ldconfig

Create the following script which will monitor a directory if you create or move something in it:

monitor.sh
#!/bin/sh
while inotifywait -e create -e move /appli/dns/input; do
/usr/bin/perl /appli/dns/traitement.pl
done

Just start this script to monitor the directory.
Now if you want this script to be run in background, at boot, or somewhere else, you can use the screen commands to achieve this :

screen -d -m /appli/dns/monitor.sh

t will start your script in an already "detached terminal"

 

fastw3b