in reply to Diagnositc output on background processes

I'm not sure if I understand what you want, but why can't you just write the output to a log file?

If necessary, create a:

END { # write output to a file here }

But I would just write to the log file as soon as I obtained the data and then use the END {} block to flush whatever might be left in the buffer.

If the code and the comments disagree, then both are probably wrong. -- Norm Schryer

Replies are listed 'Best First'.
Re: Re: Diagnositc output on background processes
by gomez18 (Sexton) on Aug 25, 2001 at 01:01 UTC
    Thanks for the great suggestions.

    I had considered that method and, indeed, that's how I've got it implemented now. The problem is that it already has a pretty substantial log file and the diagnostic stuff tends to get lost in the noise. I would prefer something that outputs right to the screen. Is such a thing possible? I'm running perl 5.6.1 on FreeBSD 4.3-Release if that makes any difference.

      Well, you could always create a separate diagnostics log file and use a different "monitor" script that simply monitors the size of the diagnostics file and then tails/echoes any new lines when detected to the screen.

      I have a script that does this for my backup job stream. When the backup job kicks off it appends whatever is in the daily log file, to the cumulative log file, deletes the daily log, kicks off the monitor job to run in the background and appends any new output to the daily log file. The monitor job echoes everything that is appended to the daily log file to the screen. It even repeats the last line periodically so that the operators can see if something is hung or not. In my case though, the monitor job only runs as long as its parent job is running. But if the terminal session hangs/dies/whatever the log file still has all the diagnostics.

      If you like, I could post both backup and monitor scripts, so you could see how they interact.

      If the code and the comments disagree, then both are probably wrong. -- Norm Schryer

        That sounds perfect. If you get a chance to post the code, that would be immensely helpful. Thanks again to everyone for all your help.

        An 8 bit man in a 32 bit world.