logs: improve ability to find logs
This commit is contained in:
parent
c723c40670
commit
3a50137b34
@ -284,8 +284,8 @@ sub get_qp_dir {
|
|||||||
return "$homedir";
|
return "$homedir";
|
||||||
};
|
};
|
||||||
foreach my $s ( qw/ smtpd qpsmtpd qpsmtpd-dev / ) {
|
foreach my $s ( qw/ smtpd qpsmtpd qpsmtpd-dev / ) {
|
||||||
if ( -d "$homedir/smtpd/plugins" ) {
|
if ( -d "$homedir/$s/plugins" ) {
|
||||||
return "$homedir/smtpd";
|
return "$homedir/$s";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
22
log/watch.pl
22
log/watch.pl
@ -3,11 +3,12 @@
|
|||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
|
||||||
|
use Cwd;
|
||||||
use Data::Dumper;
|
use Data::Dumper;
|
||||||
use File::Tail;
|
use File::Tail;
|
||||||
|
|
||||||
my $dir = find_qp_log_dir() or die "unable to find QP home dir";
|
my $dir = get_qp_dir() or die "unable to find QP home dir";
|
||||||
my $file = "$dir/main/current";
|
my $file = "$dir/log/main/current";
|
||||||
my $fh = File::Tail->new(name=>$file, interval=>1, maxinterval=>1, debug =>1, tail =>100 );
|
my $fh = File::Tail->new(name=>$file, interval=>1, maxinterval=>1, debug =>1, tail =>100 );
|
||||||
|
|
||||||
while ( defined (my $line = $fh->read) ) {
|
while ( defined (my $line = $fh->read) ) {
|
||||||
@ -15,16 +16,21 @@ while ( defined (my $line = $fh->read) ) {
|
|||||||
print $line;
|
print $line;
|
||||||
};
|
};
|
||||||
|
|
||||||
sub find_qp_log_dir {
|
sub get_qp_dir {
|
||||||
foreach my $user ( qw/ qpsmtpd smtpd / ) {
|
foreach my $user ( qw/ qpsmtpd smtpd / ) {
|
||||||
|
|
||||||
my ($homedir) = (getpwnam( $user ))[7] or next;
|
my ($homedir) = (getpwnam( $user ))[7] or next;
|
||||||
|
|
||||||
if ( -d "$homedir/log" ) {
|
if ( -d "$homedir/plugins" ) {
|
||||||
return "$homedir/log";
|
return "$homedir";
|
||||||
};
|
};
|
||||||
if ( -d "$homedir/smtpd/log" ) {
|
foreach my $s ( qw/ smtpd qpsmtpd qpsmtpd-dev / ) {
|
||||||
return "$homedir/smtpd/log";
|
if ( -d "$homedir/$s/plugins" ) {
|
||||||
|
return "$homedir/$s";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
if ( -d "./plugins" ) {
|
||||||
|
return Cwd::getcwd();
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user