Hi folks,
I often get files via network (e.g. via FTP / SFTP or via SMB/Windows "file
shares"), where I have to process these files automagically to something
else, e.g. to insert the data provided into a database.
In order to do that my software needs to know when a file is written to disk
completely, that is when the process writing down the file (i.e. FTP or the
SMB daemon) closes the file.
Reading the manuals of the current FAM implementation I understand that FAM
can tell me when the file is created and when it is modified, but the
notification when the file is closed for good seems to be missing...
Okay, I could listen for the creation and modification of a file, and when
there has been no modification for, let's say, 10 seconds or 2 minutes or
whatever, I could assume the file is complete.
But think of a short network failure, e.g. reset of a switch or re-plugging of
a network cable, this could result in some seconds or a minute of interrupt
of the file transfer with automatic recovery, so in this case my software
would assume the file complete (because of some seconds of "no
modification"), resulting in an attempt to read a still incomplete file.
So my question:
Are there any ideas to implement this "file was closed" notification?
Regards,
Mattias Brunschen
|