Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

1 Answer 1

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

#!/bin/sh
program-that-creates-xsd
program-that-does-further-processing

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

 
discard

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.