in reply to Re^2: Do Perl Programs Timeout on Their Own
in thread Do Perl Programs Timeout on Their Own

Difficult to guess without much code, but did you consider the case that your perl couldn't read anymore from the file and happily left the loop you have programmed? Perl jumps out the loop if the result is undef in your statement.

This is possible in different cases. For example if Perl is much faster then 'Snort' and 'Snort' is blocking the file while writing. Or you log is somewhere rotated by a deamon on your system and the file doesn't exists anymore as happens on any Linux system?

Catching errors and couple print statements to a small log file can give you a clue where and when your perl program quited.

For such cases (waiting for another program to append a file) i think it is better to not let the file handle the whole time open. Open the file, read everything till the EOF, sleep and restart. Use a variable to keep the track of the position in the log, for example via a time stamp in the log. Seek to the last position and start from there.

Regards

Martell

  • Comment on Re^3: Do Perl Programs Timeout on Their Own