Sunday, 8 September 2013

Continuously monitor a directory in linux and notify when a new file is available - Shell script

Continuously monitor a directory in linux and notify when a new file is
available - Shell script

I'm a starter in linux and scripting environment. My requirement is like
this:
1) From an asp.net application, a file will be generated and copied
to a predefined folder in a linux server machine. (I'm assuming this
can be done by remote file sharing using samba server)
2) A service or script or whatever should be there in linux machine
to track continuously whether file is available.
3) Once a new file is available, just parse the file, extract some
input variables and execute a shell script based on these
parameters.
My question lies in point no:2. --> How can I write a service or script
which should execute continuously and monitor whether a file is available
in a particular folder?
I've searched a lot, got into lot of links and i'm confused what is the
easiest method to do this. Because I dont want to spend lot of coding here
as the script to be executed further and the asp.net app is more important
and this should be a connector in between.
Could anybody please guide me in the right way. If similar question was
asked before, please share the link also, as i couldn't find anything
similar to this.

No comments:

Post a Comment