P
perl.coder
Hi,
I have a perl script running in production which takes a file name
to be scanned continuously and call a user exit shell program
to take action when a string it is looking for is found in
the file. All I do is to sleep for few seconds and wake
and check the size of the file and if it has changed
since last scanned, scan the new lines added since last
scan.
Now the specs has changed. We recently found that
some server process don't write to the same file,
but create a new file (usually timestamped) when
some error condition happens. So now my script
also has to change accordingly. From just monitoring
a file constantly, it also has to monitor the dir to
see whether a new file has been dropped and then start
monitoring it (also stop the earlier file it was monitoring).
So my question is, what is the fastest way to check whether
a new file has arrived in a directory. The new file name
will always have a fixed prefix, with a changing suffix
every time (usually timestamp).
Thanks in advance.
I have a perl script running in production which takes a file name
to be scanned continuously and call a user exit shell program
to take action when a string it is looking for is found in
the file. All I do is to sleep for few seconds and wake
and check the size of the file and if it has changed
since last scanned, scan the new lines added since last
scan.
Now the specs has changed. We recently found that
some server process don't write to the same file,
but create a new file (usually timestamped) when
some error condition happens. So now my script
also has to change accordingly. From just monitoring
a file constantly, it also has to monitor the dir to
see whether a new file has been dropped and then start
monitoring it (also stop the earlier file it was monitoring).
So my question is, what is the fastest way to check whether
a new file has arrived in a directory. The new file name
will always have a fixed prefix, with a changing suffix
every time (usually timestamp).
Thanks in advance.