You could try this:
use strict; use warnings; use POSIX; use Perl::Unsafe::Signals; my $appLog = '/tmp/t.txt'; my $error = 'Fatal Error'; exit if (my $pid = fork); defined($pid) or die "Can't fork: $!"; POSIX:setsid() or die "Can't setsid: $!"; my $tail = open(LOG,"/usr/local/bin/tail -F $appLog|") or die "Can't tail: $!"; $SIG{INT} = sub { close LOG; kill 3, $tail; exit; }; $SIG{TERM} = $SIG{INT}; $SIG{PIPE} = 'IGNORE'; $SIG{HUP} = 'IGNORE'; UNSAFE_SIGNALS { while (<LOG>) { #&pageMe if /$error/; print; } };
In reply to Re^2: Tail'ing a log that frequently rolls over
by BrowserUk
in thread Tail'ing a log that frequently rolls over
by frd1963
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |