On Ubuntu, how to design a monitor to run a process when a file is written to a directory?

Posted by J G on Server Fault See other posts from Server Fault or by J G
Published on 2010-04-26T23:17:41Z Indexed on 2010/04/26 23:23 UTC
Read the original article Hit count: 264

Filed under:
|
|
|
|

I want to run a process when a file is written to a directory on Ubuntu. I understand I can write a monitor to do this. (ie not an event based trigger but a 'monitor').

To implement this - other than writing a for loop of infinite duration in C that polls the directory - what steps would you take to implement this?

What steps would you take to implement a monitor on Ubuntu that runs a process (another application) when a file is written to a directory?

(The reason that you'd do this is the that process writing the file is under a limited set of permissions (eg tomcat6) but the executed process (an existing software package) needs root (ie to run a process in a chroot jail))

© Server Fault or respective owner

Related posts about monitor

Related posts about ubuntu