hi perl monks, i'm new to perl and have written code to capture packets on the network. i'm storing the packets in a text file. (using linux red hatand perl5.6)

firstly does anyone know what code i can use to let the code run for say 5 mins, and have an option for running for 10mins, thenafter this time it stops, clears the logfile,then starts again after some time.

secondly, since there is a limitation to the file size, as i, for instance, get the packetsizes which i'll use to graph the data in real-time and show batch statistics, how can i get rid of data i've already used?

graphs i'd like to implement are really very simple, one is a linegraph which will show the average number of packets over perhaps 5mins and 10mins.and the other is a bar graph that will show the 5 hoststhat sent the most traffic in the time interval specified.
any ideas on how todo this in the quickest time??


In reply to real-time packet capture by PEACHHORSE

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.