rickgerdes
IS-IT--Management
Here's the deal-
I need to have a program (PERL) know when a file is closed. Specifically what I am trying to do is wait for a process that may or may not be running to complete. If it's running, it is writing a log file, if it's done, the last log in the directory should be closed.
I can find the file just fine, but I cannot figure out how to either read it (correctly) for checking for the reference to it's being complete, or checking some unary to see if it's open. I'm going nuts here.
The logs are in xml and trying to read them give me inconsistent data. Most parse to flat text, but a few parse to spaces between characters. So reading for completetionStatus sometimes needs to be c o m p l e t i o n S t a t u s, but that pattern doesn't match correcly. I'd rather not read the file at all.
Simplest process- look in a given directory for the last file with .xml extension. Is it being written to? If yes, wait five minutes and check again, if not, continue on.
Any help out there? Thanks folks!
I need to have a program (PERL) know when a file is closed. Specifically what I am trying to do is wait for a process that may or may not be running to complete. If it's running, it is writing a log file, if it's done, the last log in the directory should be closed.
I can find the file just fine, but I cannot figure out how to either read it (correctly) for checking for the reference to it's being complete, or checking some unary to see if it's open. I'm going nuts here.
The logs are in xml and trying to read them give me inconsistent data. Most parse to flat text, but a few parse to spaces between characters. So reading for completetionStatus sometimes needs to be c o m p l e t i o n S t a t u s, but that pattern doesn't match correcly. I'd rather not read the file at all.
Simplest process- look in a given directory for the last file with .xml extension. Is it being written to? If yes, wait five minutes and check again, if not, continue on.
Any help out there? Thanks folks!