NewtownGuy
Technical User
I'm not sure if this is the right place for this question. I'm running Ubuntu Server 10.04 LTS. This machine is continuously acquiring data in real time and adding snippets of data to various of tens of thousands of files. From time to time, I have a bash program read all the files in turn and process the data in each one.
The problem is that some file reads are getting mixed up. (I checked the files and they're ok.) Sometimes, in my log file that shows the data read and the processing that was done, I see parts of several different files when I'm trying to read only one file. The files whose reads are getting mixed up were updated while my analysis program was running.
When I read a file, I read the whole file into an array, from which I do the processing for that file. Then I go on to the next one.
How do I avoid file reads getting mixed up ? I can't stop the data acquisition process, which can update any of the many files. Sometimes, something is going wrong while I'm reading a given file into an array.
I considered copying each file to a temp file before I analyze it, but I have 100's of MB of files in total and don't want to wear out the disk, and I'm concerned that the copying would be corrupted anyway if the file happens to get updated while I'm trying to copy it.
Thank you in advance for your help.
The problem is that some file reads are getting mixed up. (I checked the files and they're ok.) Sometimes, in my log file that shows the data read and the processing that was done, I see parts of several different files when I'm trying to read only one file. The files whose reads are getting mixed up were updated while my analysis program was running.
When I read a file, I read the whole file into an array, from which I do the processing for that file. Then I go on to the next one.
How do I avoid file reads getting mixed up ? I can't stop the data acquisition process, which can update any of the many files. Sometimes, something is going wrong while I'm reading a given file into an array.
I considered copying each file to a temp file before I analyze it, but I have 100's of MB of files in total and don't want to wear out the disk, and I'm concerned that the copying would be corrupted anyway if the file happens to get updated while I'm trying to copy it.
Thank you in advance for your help.