Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to automate the process of executing a command upon creation of a file. I have an application wherein a tool generates an xsd schema from a xml file. My next module uses this xsd schema for further processing.
I want to automate this process i.e. to run a command once the file is generated. This application will run everyday on ubuntu machine so I want to automate it. I don't want any human intervention in this process. I did search inotify lib which is used for similar purposes but it forces me to change the enitre design of my system.
Are there any other alternatives which would solve this purpose? Any help is highly appreciated.

share|improve this question

Figuring out when the file is finished being written is the hard part. It is best to use a script like:


There really aren't any good solutions if you can't structure your program like this. Even with inotify, it is nearly impossible to tell when the XSD is truly finished.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.