Hey Christoph,

Looks like the file you are trying to pipe the information to is not
executable. Make sure the execute bit is set:

chmod +x /etc/spamdyke-statistics.pl

Cheers,
Sebastian

On Wed, 2009-08-05 at 17:34 +0100, Christoph Kuhle (Expat Email Ltd)
wrote:
> Les showed some great stats, and I found Ken Schweigert's great thread in
> the archives
> http://www.mail-archive.com/[email protected]/msg00771.html  
> 
> I have tried to set it up, with some problems, and hope that someone can
> help.  I probably need a little hand-holding as I am new to Perl.
> 
> I have set up a file /etc/spamdyke-statistics.pl whose contents are as
> follows:
> 
> [r...@plesk2 ~]# cat /etc/spamdyke-statistics.pl
> #!/usr/bin/perl -w use diagnostics; use strict;
> 
> # Usage:  # cat /var/log/mail | ./this_file
> 
> my %status = ();        # hash of status connections
> my ($allow, $deny, $spampercentage, $sum);
> 
> $allow = 0;
> 
> while(<>){
>         my $line = $_;
>         if( m/spamdyke\[/ ){
>                 my ($a, $b, $c, $d) = split(/:/ , $line);
>                 my ($e, $sdstatus) = split(/ /, $d);
>                 #print "$b\n";
>                 next if $sdstatus eq "CHKUSER";
>                 $status{$sdstatus}++;
>         }
> 
> }
> foreach my $stat (sort keys %status){
>         if( $stat =~ m/ALLOWED/){
>                 $allow = $status{$stat};
>         }
>         else{
>                 $deny += $status{$stat};
>         }
> }
> 
> $spampercentage = sprintf("%.2f", ($deny/($allow+$deny)*100) );
> 
> foreach my $key (sort { $status{$b} <=> $status{$a} || $a cmp $b; } keys
> %status ){
>     print "$status{$key}\t$key\n";
> }
> $sum = ($deny + $allow);
> print "\n";
> print "Allowed: $allow \n";
> print "Denied : $deny \n";
> print "Sum: $sum \n";
> print "% Spam : $spampercentage% \n";
> 
> [r...@plesk2 ~]#
> 
> My normal maillog is at /usr/local/psa/var/log/maillog (where the spamdyke
> results show with all mail activity).
> 
> So I tried a number of things to get the results from root login, and they
> are failing.  If someone can give me some newbie help, I would be really
> grateful.
> 
> [r...@plesk2 ~]# cat /usr/local/psa/var/log/maillog |
> /etc/spamdyke-statistics.pl
> -bash: /etc/spamdyke-statistics.pl: Permission denied
> 
> [r...@plesk2 ~]# cat /var/log/mail | /etc/spamdyke-statistics.pl
> -bash: /etc/spamdyke-statistics.pl: Permission denied
> cat: /var/log/mail: Is a directory
> 
> Many thanks in advance
> 
> Kind regards, 
>  
> Christoph
> 
> _______________________________________________
> spamdyke-users mailing list
> [email protected]
> http://www.spamdyke.org/mailman/listinfo/spamdyke-users
-- 
Sebastian Grewe
Jammicron | Experts in Powering Online Sales
Phone 604.331.0586 x 104
Fax 604.331.0587
www.jammicron.com | www.qwik.ca



_______________________________________________
spamdyke-users mailing list
[email protected]
http://www.spamdyke.org/mailman/listinfo/spamdyke-users

Reply via email to