This sounds like a logrotate problem.

Do you have logrotate controlling this log file.

I may be wrong, but I think if you have the file open when logrotate 
kicks in, you filehandle will stay on the same file. i.e.

you open /var/log/maillog
logrotate removes /var/log/maillog.4
it then renames 3 to 4, 2 to 3, and 1 to 2.
it then renames /var/log/maillog to /var/log/maillog.1 and
then creates /var/log/maillog.

you will then be reading the end of /var/log/maillog.1 which will never 
get written to.

Gary
On Thursday 24 May 2001  7:28 pm, Chris Lott wrote:
> I have a simple little perl program that monitors the email log file
> for rejected messages (see below). I start the program using "nohup
> script.pl &" and it works fine, sending me an email with info about
> each rejected message. However, it just dies out randomly after a day
> or so for no reason that I can figure. The script is still there as a
> process, but it doesn't perform.
>
> Is there another way I should be approaching this task?
>
> #!/usr/bin/perl
>
>      $maillog = "/var/log/maillog";
>      $TAIL = "/usr/bin/tail";
>
>       open(MAILLOG,"$TAIL -f $maillog |") || die("Can't $TAIL -f
> $maillog"); while($line = <MAILLOG>) {
>         if ($line =~ /blocked/) {
>        system("echo '$line' | mail -s 'RBL rejection' foo\@bar.com");
>         }
>      }
>      close(MAILLOG);
>      exit(1);

-- 
Gary Stainburn
 
This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000 
    

Reply via email to