procmail
[Top] [All Lists]

Re: Procmail log w/root-tail

2000-01-20 23:12:58
"S.Toms" <tomas(_at_)primenet(_dot_)com> writes:
 I have a situation where I view the entries to the logfile for procmail
within a root-tail window on my screen, I'm sure many of you are familiar
with this. Anyway, I have mailstat run every 8 hours within my personal
crontab and have noticed the following.
 When mailstat runs on the logfile, it moves the original to 'log.old'
and creates a new 'log' file within the same directory, the problem is
that root-tail is still linked to the original logfile which is now called
'log.old'. What I mean by this is, when new entries are added to 'log'
root-tail no longer aknowledges these entries, but if you add something to
the original file, 'log.old' the new entries will show up in the root-tail
window.
...
3. Has anyone else come across this situation before? and if so, how was
  it overcome if at all?

 Maybe a way to relink root-tail to the original logfile, or a way to
prevent mailstat from making the file link change when it runs.

Kill and restart the tail when you run mailstat.  This can be as simple
as putting the tail in a shell script that catches a signal:

        #!/bin/sh
        logfile=$1
        trap 'kill $PID' 1 15
        while :
        do
            tail -f $logfile &
            PID=$!
            wait
        done

Is you send signal 1 (HUP) or 15 (TERM, the default) to the shell running
that script, it'll kill and restart the tail.  You can even just kill
the tail itself and it'll restart it.


Philip Guenther