in reply to General Question: File triggered job launcher

If you are in control of the files coming into the directories in question, there is a much simpler technique available that doesn't rely on file locking. This makes things much more robust.

On the flip side, you need the cooperation of the file provider.

Arrange to have things so that the provider sends two files, the data file itself (foobar.txt) and when all is done, files closed, buffers flushed, speakers burst, amps all wet (ah no, that's a Sonic Youth song I'm thinking of)... you then create a second file named 'foobar.txt.check'.

Creating the check file can be as simple as open F, 'foo.txt.check' and close F. You then just have to look for check files. If one exists, you are guaranteed that the file it refers to has been written in its entirety.

After you are done with the file, you can at least delete the check file, so that you don't attempt to reprocess it. From there, you can either also delete the corresponding data file, or else the provider can later scan the directory, and delete any data files for which there no longer corresponds a check file.

--
g r i n d e r

Replies are listed 'Best First'.
Re: Re: General Question: File triggered job launcher
by Bjoern (Novice) on Dec 03, 2001 at 13:27 UTC
    Thanks to all who replied,
    I saw some things I already implemented, but I also got some ideas that might help me a bit with the task.

    Bjoern