in reply to Re: •Re: File tracking
in thread File tracking

Is my implementation of "tail -f" neat enough? I think so.

I don't know if sleep/poll cycles are the most efficient way of doing things here. You might want to try using select if you can.

... is the reopening of the current logfile done properly assuring no loss of data

I'm not sure.. imagine this scenario:

  1. Your process scans the logs.
  2. Your process sleeps.
  3. While you are sleeping, the server outputs the bad error lines.
  4. Still while you are sleeping, the logs get rotated.
  5. When you wake up, you'll start processing the new file and never see the error lines.

Replies are listed 'Best First'.
Re: Re^3: File tracking
by r (Initiate) on Jul 06, 2002 at 19:35 UTC
    Thanks a lot for the first concrete steps towards a work around - work forever solution regarding lifetime of certain servers.

    I am aware of sleep being the possible "loss of data" - period, your scenario explains the problem excellently.
    Besides, I am stopping and re-starting the server because no other action (kill -HUP, native restart) solves the hang-up.
    What would be your approach (using select)?

    Be the munk that enlightens my soul and mind :-)

    -r