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


In reply to Re^3: Do Perl Programs Timeout on Their Own by martell
in thread Do Perl Programs Timeout on Their Own by ahuang14

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.