XMailforum is a readonly knowledge archive now.

Registering as a new user or answering posts is not possible anymore.

Might the force be with you, to find here what you are looking for.

2019-09-20 - hschneider, Admin

Cookie Disclaimer: This forum uses only essential, anonymous session cookies (xmailforum*), nothing to be scared of.

XMail Forum -> Log Reader

Reply to this topicStart new topicStart Poll

> Log Reader
jeffu
Posted: Jan 22 2009, 12:17 AM
Quote Post


Newbie
*

Group: Members
Posts: 5
Member No.: 3146
Joined: 15-January 09



Hello,

Where can I download the "Log Reader"? The download link is broken... http://www.kryptontech.com/modules.php?nam...wdownload&cid=2.

Or is there any other tools or scripts to read to logs. I'm running Xmail on Windwos. I need some kind of reporting tool that will give me the total of email sent daily.

Thanks in advance!

- Jeff
PMEmail Poster
Top
jcarlock
Posted: Jan 24 2009, 01:49 AM
Quote Post


Newbie
*

Group: Members
Posts: 15
Member No.: 3010
Joined: 14-September 08



Without really knowing what the log-reader really is or does, if you just need something to read/edit/view log files manually, I'd suggest using something like SciTE (Scintilla Tiny Editor). It's the most invalualable tool on my machine, but not only for viewing files, but for editing scripts as well.

Trick is to place a link to it into your SendTo list of items. Then you can right click upon any file while exploring with Explorer and SendTo the link, which opens the document up for viewing or editing.

http://sourceforge.net/projects/scintilla

%userprofile%\SendTo\

Hope this helps.

--
Jim Carlock
http://www.microcosmotalk.com/


--------------------
--
Jim Carlock

AIM:jwcarlock
rocketmail:jcarlock
live:j.carlock
gmail:microcosmotalk
PMEmail PosterUsers WebsiteAOLMSN
Top
BooT
Posted: Feb 24 2009, 05:49 PM
Quote Post


Guru
**********

Group: Members
Posts: 747
Member No.: 375
Joined: 29-November 02



Hi

This is the script I Use to Do my monthly stats. It is a Perl Scipt. Copy this text into a file. Name it anything.pl and run it.

It creates an output with a date. Rename it to html and then you can view it.

Just change the path's to your xmail and the output folder.

Thanx

BooT

CODE

#!/usr/bin/perl
use File::stat qw(:FIELDS);
# MVXstat v1.24
# Create by Igor Reno (aka MayVortex: root@dinfo.ru)
############# SETUP SECTION ###########################################
# ============ Path Setup =====================
$pathtl = "/MailRoot/logs/";    #path to logs
$mailroot = "/MailRoot";      #path to MailRoot
$html_out = "/MailRoot/_Stat.Reports/MvxStats_DomainSizepermonth/Report.html"; # HTML Output
$PathTD = "/MailRoot/domains";
# ============ Common Setup ==================
$onlyxfm = 2; # 2 - both (xfm and stat), 1 - only xfm, 2 - only stat
$stamped = 1; # Report.html -> ReportDDMMYYYY.html
#@monthrange = ('1 - 10','2003');
# =========== MVXStat Setup ==================
# ~ Comment for disable / uncomment for enable ~
$monthly = '200901'; # Generate stat for April 2003 (200304)
#$frd = '20030726';    # Scan from date
$top = 100;        # show only 10 first for each domain
#@domains = ('domain1.com','teledom.ru'); # Autodetec if commented
#@domains = ('domain1.com'); # Autodetec if commented

$sort_by = '-7n';
# U can change this value at:
# 1 - by User
# 2n - by Mess Out
# 3n - by Size Out
# 4n - by Mess In
# 5n - by Size In
# 6n - by Domain (NOT Work!)
# 7n - by Total Size
# 8n - by Total Count (NOT Work yet!)
# Or U can use revers by adding '-' before value ('-2n', '-1' etc)

# ============ XFM Setup =====================
# ~ Comment for disable / uncomment for enable ~
$hostname = 'ns\.dinfo\.ru';  # Get this from message file name:
   # 1054089723959.3747867.ns.dinfo.ru.
$topxf = 10;    # show only 10 first for each domain
$sortx_by = '-2n';
# U can change this value at:
# 1 - by User
# 2n - by Size
# 3n - by Count
# 4n - N/A
# 5 - by Date
# Or U can use revers, by adding '-' before value ('-2n', '-1' etc)

# =========== Send report setup ==================
#$send_to = 'root@dinfo.ru';        # Send log (uncomment for enable)
#$server_ip = '127.0.0.1';        # SMTP server IP address (no need if prev commented)
########### END OF SETUP SECTION ##################################

if (@monthrange){
$mrange = @monthrange[0];
$mrange =~ s/ //g;

@mrange = split('\-',$mrange);
@mrfrom = split('',@mrange[0]);
@mrto = split('',@mrange[1]);
$mrfrom=@mrange[0];
$mrto=@mrange[1];

$htmlotmp=$html_out;
for ($zmi=$mrfrom; $zmi<=$mrto; $zmi++){
   if($zmi<10){$zdate = '0'.$zmi;}
   else{$zdate = $zmi;}
   open(A,'>users.bd'); close(A);
   open(A,'>domain.bd'); close(A);
   open(A,'>last'); close(A);
   $onlyxfm=2;
   $monthly = @monthrange[1].$zdate;
   print "\n".$monthly."\n";
   main_programm();
}
}
else {main_programm();}



sub main_programm{
if (!$monthly){$monthly = $ARGV[0];}
if ($send_to){require MIME::Lite;}
if (!@domains){
   open(DOM,"$mailroot/domains.tab");
   @domains = <DOM>;
   close(DOM);
}
$html_out_tmp = $html_out;
if ($onlyxfm==1){xfm(); exit 0;}
if ((!$onlyxfm) or ($onlyxfm==0)){xfm();}
$html_out = $html_out_tmp;
opendir(DIR,$pathtl) || print "Can't open $pathtl - $!";
@ip = readdir(DIR);
closedir(DIR);
my $newip;
foreach $ip(sort(@ip)){
   if ($monthly){
@sip = split('-',$ip);
$sip = @sip[1];
@sip = split('',$sip);
$sip = @sip[0].@sip[1].@sip[2].@sip[3].@sip[4].@sip[5];
if ($sip eq $monthly){$newip = $newip."|".$ip;}
   } else {$newip = $newip."|".$ip;}
}
@ip = split('\|',$newip);
my $count=0; my $ok=0;
my ($top_cnt,$bit,$rom,$zmn,$from_date, $from_time, $bin,$other,$last_date, $last_time, $from, $to, $in_cnt, $in_size, $out_size, $out_cnt, $local_cnt, $local_size, $in_cnt_ok, $out_cnt_ok, $local_cnt_ok);
$max = 0;
$fullsize=0;
if ($frd){
   @ipt = split('\|',$newip);
   foreach $ipt(@ipt){
if (($ipt =~ m/smtp-/g) and ($ipt =~ m/$frd/g)){$frdx=$ipt;}
   }
   open(FROMD,$pathtl.$frdx);
   @frd = <FROMD>;
   close(FROMD);
   $ffrd = @frd[0];
   @ffrd = split('\t',$ffrd);
   @ffrd[3]=~s/\"//g;
   @last = ($frdx,@ffrd[3]);
} else {
open(LASTX,"last");
@last = <LASTX>;
close(LASTX);
}
if (@last){
   $stop=1;
   $stop_x=1;}
   if (!$monthly){
$from_date = @last[0];
$from_time = @last[1];
   } else {
$from_time = $monthly."01 00:00:01";
   }
if (-e "domain.bd"){
   open(BD,"domain.bd");
   $bd=<BD>;
   close(BD);
   @bd = split('\|',$bd);
   ($fullsize,$count,$ok,$in_size,$out_size,$local_size,$in_cnt,$in_cnt_ok,$out_cnt,$out_cnt_ok,$local_cnt,$local_cnt_ok) = @bd;
}

if (-e "users.bd"){
   open(BD1,"users.bd");
   @bd1 = <BD1>;
   close(BD1);
   foreach $bd1(@bd1){
@bdnew = split('\~',$bd1);
@bdnew[scalar(@bdnew)-1]=~ s/\n//g;
$usersx{@bdnew[0]} = @bdnew[1];
   }
}
foreach $ip(@ip){
   $ip =~ tr/A-Z/a-z/;
   @last[0] =~ s/\n//g;
   @last[0] =~ s/\r//g;    
   if ($ip eq @last[0]){undef($stop);}
   if (($ip =~ m/smtp-/g) and (!$stop)){
$last_date=$ip;
open(ZIP,$pathtl.$ip);
@size=<ZIP>;
close(ZIP);
foreach $size(@size){
    @heh = split('\t',$size);
    @heh[3] =~ s/\"//g;
    $last_time=@heh[3];
    if (@heh[3] eq @last[1]){undef($stop_x);}
    if (!$stop_x){
    @heh[11] =~ s/\"//g;
    $count++;
    $fullsize = $fullsize+@heh[11];
    if (($size =~ m/RCPT=OK/g) or ($size =~ m/RECV=OK/g)){$ok++}
    undef($bin);
    undef($rom);
    foreach $dom(@domains){
 $dom =~ s/\"//g;
 $dom =~ s/\n//g;
 $from = @heh[6];
 $to   = @heh[7];
 $to =~ s/\"//g;
 $from =~ s/\"//g;
 $to =~ tr/A-Z/a-z/;
 $from =~ tr/A-Z/a-z/;
 @from = split('\@',$from);
 @to = split('\@',$to);
 if (!$rom){
 if ((@from[1] eq $dom) and (($size =~ m/RCPT=OK/g) or ($size =~ m/RECV=OK/g))){
     $zmn=$usersx{@from[0]};
     #@zmn[0] - Message Count Out
     #@zmn[1] - Size Out
     @zmn = split('\|',$zmn);
     @zmn[0]++;
     @zmn[1] += @heh[11];
     $zmn = @zmn[0]."|".@zmn[1]."|".@zmn[2]."|".@zmn[3]."|".@from[1];
     $usersx{@from[0]}=$zmn;

     $rom = 1;
 }
 if ((@to[1] eq $dom) and (($size =~ m/RCPT=OK/g) or ($size =~ m/RECV=OK/g))){
     $zmn=$usersx{@to[0]};
     #@zmn[2] - Message Count IN
     #@zmn[3] - Size IN
     @zmn = split('\|',$zmn);
     @zmn[2]++;
     @zmn[3] += @heh[11];
     $zmn = @zmn[0]."|".@zmn[1]."|".@zmn[2]."|".@zmn[3]."|".@to[1];
     $usersx{@to[0]}=$zmn;
     $rom = 1;
 }
 } else {undef($rom);}


 if (!$bin){
 if ((@from[1] ne $dom) and (@to[1] eq $dom)){
     if (($size =~ m/RCPT=OK/g) or ($size =~ m/RECV=OK/g)){$in_cnt_ok++;}
     $in_cnt++; $in_size += @heh[11];
     $bin=1;
 }
 if ((@from[1] eq $dom) and (@to[1] ne $dom)){
     if (($size =~ m/RCPT=OK/g)  or ($size =~ m/RECV=OK/g)){$out_cnt_ok++;}
     $out_cnt++; $out_size += @heh[11];
     $bin=1;
 }
 if ((@from[1] eq $dom) and (@to[1] eq $dom)){
     if (($size =~ m/RCPT=OK/g) or ($size =~ m/RECV=OK/g)){$local_cnt_ok++;}
     $local_cnt++; $local_size += @heh[11];
     $bin=1;
 }
 if ((@from[1] ne $dom) and (@to[1] ne $dom)){}
 }else{undef($bin);$test=1;}
    }
    if($test==0){$other++;}
    $test=0;
    print "Size=".$fullsize."/Count=".$count."\r";
    }
}
   }
}


open(LASTX,">last");
$last_date=~ s/\n//g;
print LASTX $last_date."\n".$last_time;
close(LASTX);
open(BD1,">domain.bd");
$other = $count-($in_cnt+$out_cnt+$local_cnt);
print BD1 $fullsize."|".$count."|".$ok."|".$in_size."|".$out_size."|".$local_size."|".$in_cnt."|".$in_cnt_ok."|".$out_cnt."|".$out_cnt_ok."|".$local_cnt."|".$local_cnt_ok;
close(BD1);

if ($stamped==1){
   my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime (time);
   $year = 1900 + $year; $mon = $mon + 1;
   if ($mon < 10){$mon = "0".$mon;}
   if ($mday < 10){$mday = "0".$mday;}
   my @htmlout;
   $html_out = $htmlotmp;
   @htmlout = split('\.',$html_out);
   if (!$monthly){
       @htmlout[0] = @htmlout[0].$mday.$mon.$year;
   } else {
@htmlout[0] = @htmlout[0].$monthly;
   }
   $html_out = join('.',@htmlout);
   
}
if ($onlyxfm == 0) {open(HTMLOUT,">>$html_out"); }
else {
   open(HTMLOUT,">$html_out");
   print HTMLOUT "<HTML>\n<BODY>\n";
}
print HTMLOUT "Start scan: $from_time/Stop scan: $last_time<br>\n";
print HTMLOUT "<table cellspacing=0 cellpadding=0 border=1 bgcolor=lightgrey>\n";
print HTMLOUT "<tr bgcolor=black><td>&nbsp;</td><td><font color=white>Message count</font></td><td><font color=white>Message size</td></tr></font>\n";
$size_cnt=$in_size;
$in_size=splitter();
$size_cnt=$out_size;
$out_size=splitter();
$size_cnt=$local_size;
$local_size=splitter();
print HTMLOUT "<tr><td>In</td><td>".$in_cnt."(".$in_cnt_ok.")</td><td>".$in_size."</td></tr>\n";
print HTMLOUT "<tr><td>Out</td><td>".$out_cnt."(".$out_cnt_ok.")</td><td>".$out_size."</td></tr>\n";
print HTMLOUT "<tr><td>Local</td><td>".$local_cnt."(".$local_cnt_ok.")</td><td>".$local_size."</td></tr>\n";
$other = $count-($in_cnt+$out_cnt+$local_cnt);
print HTMLOUT "<tr><td>Other</td><td>".$other."</td><td>&nbsp;</td></tr>\n";
$size_cnt=$fullsize;
$fullsize = splitter();
print HTMLOUT "<tr bgcolor=black><td><font color=white>Total</font></td><td><font color=white>".$count."(".$ok.")</font></td><td><font color=white>".$fullsize."</td></tr></font>\n";
print HTMLOUT "</table><br><table cellspacing=0 cellpadding=0 border=1 bgcolor=lightgrey>";
print HTMLOUT "<tr bgcolor=black><td bgcolor=black><font color=white>User</font></td><td><font color=white>Size Out</font></td><td><font color=white>Mess Out</font></td><td><font color=white>Size In</font></td><td><font color=white>Mess In</font></td><td><font color=white>Total size</font></td><td><font color=white>Total Messages</font></td></tr></font>\n";
open(BD2,">users.bd");
while (($username,$messcnt) = each(%usersx)) {
   $endd = $username."~".$messcnt;
   @tmp = split('\|',$messcnt);
   $totx=@tmp[3]+@tmp[1];
   $totsx=@tmp[4]+@tmp[2];
   $for_sort = $for_sort.$username."|".$messcnt."|".$totx."|".$totsx."\n";
   print BD2 $endd."\n";
}
close(BD2);

   @array_field = split('\n',$for_sort);
   @sorted=sort_field('\|', [$sort_by], @array_field);
   foreach $doom(@domains){
print HTMLOUT "<tr><td colspan=7 bgcolor=darkgray><center><strong>$doom</strong></center></td></tr><br>\n";
$top_cnt=0;
foreach $sorted(@sorted){
    @messcnt = split('\|',$sorted);

    if (($doom eq @messcnt[5]) and ($top_cnt<=$top)){
 $top_cnt++;
 $tot=@messcnt[3]+@messcnt[1];
 $tots=@messcnt[4]+@messcnt[2];
 $size_cnt = $tots;
 $tots = splitter();
 $size_cnt = @messcnt[2];
 @messcnt[2] = splitter();
 $size_cnt = @messcnt[4];
 @messcnt[4] = splitter();
 if (@messcnt[1] eq ''){@messcnt[1] = "&nbsp;";}
 if (@messcnt[2] eq ''){@messcnt[2] = "&nbsp;";}
 if (@messcnt[3] eq ''){@messcnt[3] = "&nbsp;";}
 if (@messcnt[4] eq ''){@messcnt[4] = "&nbsp;";}
 print HTMLOUT "<tr><td>@messcnt[0]</td><td>@messcnt[2]</td><td>@messcnt[1]</td><td>@messcnt[4]</td><td>@messcnt[3]</td><td>$tots</td><td>$tot</td></tr>\n";
    }
}
   }
{print HTMLOUT "</table></BODY>\n</HTML>";
close(HTMLOUT);
if ($send_to){send_to();}
sub send_to{
   open(HTMLOUT,"$html_out");
   @htmlout = <HTMLOUT>;
   close(HTMLOUT);
   $send_rep = join('',@htmlout);

   $msg = MIME::Lite->new(
   From    => $send_to,
   To      => $send_to,
   Subject => 'Your Report',
   Type    => 'multipart/related');
   $msg->attach(
   Type => 'text/html; charset=windows-1251',
   Data => $send_rep);
   MIME::Lite->send('smtp', $server_ip, Timeout=>60);
   $msg->send();
}

sub splitter{
   my $bit; my $cx=0; my $it=0;
   if (!$size_cnt){$size_cnt = $_[0];}
   my @bit = split('',$size_cnt);
   my $bit_cnt = scalar(@bit);
   if ($bit_cnt>3){
for(my $zz=$bit_cnt-1; $zz>=0; $zz--){
    $cx++;
        if ($cx==4){$cx=1; $bit=~s/\./ /g; $bit = @bit[$zz].".".$bit; $it++;}
    else {$bit = @bit[$zz].$bit;}
}
   } else {$bit = join('',@bit);}
   if ($bit_cnt>0){
   if ($it==0){$bit = $bit." (b)";}
   if ($it==1){$bit = $bit." (Kb)";}
   if ($it==2){$bit = $bit." (Mb)";}
   if ($it==3){$bit = $bit." (Gb)";}
   if ($it==4){$bit = $bit." (Tb)";}
   }
   return $bit;
}

sub sort_field {
my ($separator, $cols);
$separator = ref $_[0] ? '\|' : shift;

# unless(ref($cols=shift) eq 'ARRAY') { print "Chto-to tam"; }
$cols = shift;

my (@sortcode, @col);
my $num = 1;

foreach (@$cols) {
my ($a, $b) = /^-/ ? qw(b a) : qw(a b);
my $op = /n$/ ? '<=>' : 'cmp';
push @col, (/(\d+)/)[0]-1;
push @sortcode, "\$${a}->[$num] $op \$${b}->[$num]";
$num++;
}

my $sortfunc = eval "sub { " . join (" || ", @sortcode) . " }";
my $splitfunc = eval 'sub { (split /$separator/o, $_)[@col] }';

return map $_->[0], sort { $sortfunc->() } map [$_, $splitfunc->($_)], @_;
}

sub xfm{
   @htmlout = split('\.',$html_out);
   @htmlout[1] = 'txt';
   $output_file = join('.',@htmlout);
   my $count=0; $size_cnt=0; my $domain_size=0; my $mess_cnt=0;
   my $file_date=0;
   if (!$output_file){$output_file="dom.txt";}
   if (!@domains){
opendir(DIR,$PathTD) || die "Can't open $PathTD - $!";
@h_domains = readdir(DIR);
closedir(DIR);
   } else {@h_domains = @domains;}
   open(DMN,">".$output_file);
   foreach $h_domain(@h_domains){
$h_domain =~ s/\"//g;
$h_domain =~ s/\n//g;
if (($h_domain eq ".") or ($h_domain eq "..")){} else{
    $go_path = $PathTD.'/'.$h_domain;
    print DMN "User\tsize\tcount\tdomain\tdate\n";
    print DMN "============ $h_domain =============\n";
    print "\n\n";
    &dorec([$go_path],"procFiles",".*\$");
    print DMN "Total MailDir: ".$count."\n";
    print DMN "Total Size: ".$size_cnt."\n";
    print DMN "====================================\n";
    $count=0;
    $size_cnt=0;
       }
   }
   close(DMN);

   open(SRCD,$output_file);
   @htmlin = <SRCD>;
   close(SRCD);
   
   if ($stamped){
($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime(time);
$year = 1900 + $year; $mon = $mon + 1;
if ($mon < 10){$mon = "0".$mon;}
if ($mday < 10){$mday = "0".$mday;}
       $tm = $mday.$mon.$year;
   }
   $html_output = $html_out;
   @html_output = split('\.',$html_output);
   @html_output[0] = @html_output[0]."xfm";
   if ($stamped){@html_output[0] = @html_output[0].$tm;}
   $html_output = join('.',@html_output);
   @htmlout = split('\.',$html_out);
   if ($stamped){
@htmlout[0] = @htmlout[0].$tm;
$html_out = join('.',@htmlout);
   }

   if ($onlyxfm != 0) {
open(HTMLOUT,">$html_output");
print HTMLOUT "<HTML>\n<BODY bgcolor=white>\n<H2>XFM (Real-time MailDir info):</H2><table bgcolor=lightgrey border=1 cellspacing=0>\n";
   } else {
open(HTMLOUT,">$html_out");
print HTMLOUT "<HTML>\n<BODY bgcolor=white>\n\n<H2>XFM (Real-time MailDir info):</H2><table bgcolor=lightgrey border=1 cellspacing=0>\n";
   }
   $html_s = $html_out;
   @array_field=@htmlin;
   foreach $arr_lst(@array_field){
$arr_lst =~ s/\n//g;
if ($arr_lst !~ m/\t/g){}
else {
    $ok_lst = $ok_lst.$arr_lst."\n";
}
   }
   @array_field = split('\n',$ok_lst);
   @sorted=sort_field('\t', [$sortx_by], @array_field);
   $top_tmp=$topxf;
   foreach $domm (@domains){
$topxf = $top_tmp;
$domain_size=0;
$mess_cnt = 0;
$domm =~ s/\"//g;
$domm =~ s/\n//g;
print HTMLOUT "<tr><td colspan=4 bgcolor=black><font color=white><strong><center>".$domm."</center></font></strong></td></tr>\n";
print HTMLOUT "<tr bgcolor=black><td><font color=white><strong><center>User</center></font></strong></td><td><font color=white><strong><center>Size</center></font></strong></td><td><font color=white><strong><center>Count</center></font></strong></td><td><font color=white><strong><center>Last Access</center></font></strong></td></tr>\n";
$html_out = '';
foreach $html_out(@sorted){
    @html_out = split('\t',$html_out);
    if ($domm eq @html_out[3]){
 if ($html_out !~ m/user\tsize/gi){
     $topxf--;
     @html_out = split('\t',$html_out);
     $domain_size += @html_out[1];
     $mess_cnt += @html_out[2];
     @html_out[1] = &splitter(@html_out[1]);
     undef($size_cnt);      
     if ($topxf>0){print HTMLOUT "<tr><td>".@html_out[0]."</td><td>".@html_out[1]."</td><td>".@html_out[2]."</td><td>".@html_out[4]."</td></tr>\n";}
 }
    }
}
undef($size_cnt);
       $domain_size = splitter($domain_size);
       undef($size_cnt);
       print HTMLOUT "<tr bgcolor=darkgray><td>Total:</td><td>".$domain_size."</td><td>".$mess_cnt."</td><td>&nbsp;</td></tr>\n";
   }
   print HTMLOUT "</table>\n";
   if($onlyxfm != 0){
print HTMLOUT "</BODY>\n</HTML>\n";
   } else {print HTMLOUT "<br><br><H2>MVXStat (Log analyzer):</H2><br>";}
   close(HTMLOUT);

   if (($send_to) and ($onlyxfm != 0)){
if ($onlyxfm == 0){open(HTMLOUT,"$html_out_tmp");}
       else {open(HTMLOUT,"$html_output");}
       @message=<HTMLOUT>;
       close(HTMLOUT);
       $message = join('',@message);
       $msg = MIME::Lite->new(
       From    => $send_to,
       To      => $send_to,
       Subject => 'Your Report',
       Type    => 'multipart/mixed');
       $msg->attach(Type     =>'text/html',
       Data     => $message);
       MIME::Lite->send('smtp', $server_ip, Timeout=>60);
       $msg->send();
   }
}

sub get_file_date{
   $f_path = $path;
   $f_path =~ s/user.tab/.ipconn/g;
   $stats = stat($f_path) or ($er = 1);
   if (!$er){$stats->mtime;}
   else {undef($er);}
   ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime($st_mtime);

   $year = 1900 + $year; $mon = $mon + 1;
   if ($mon < 10){$mon = "0".$mon;}
   if ($mday < 10){$mday = "0".$mday;}
   $file_date = $year."/".$mon."/".$mday;
   return $file_date;
}

sub dorec {
   my $delim = '/';
   local(*paths) = $_[0];
   local($path);
   $fun = $_[1];
   $pattern = $_[2];
   foreach $path (@paths) {
next if $path =~ m%/\.$%; # Skip current
       next if $path =~ m%/\.\.$%; #  and parent directory
       if (-f $path && ($path =~ /$pattern/o)) {
           &$fun($path);
       } elsif (-d $path) {
           opendir(DIR,$path) || die "Can't open $path - $!";
           local(@files) = readdir(DIR);
           closedir(DIR);
           foreach (@files) { # Add directory part
               $_ = $path . $delim . $_;
           }
    &dorec(*files,$fun,$pattern);
       }
   }
}

sub procFiles() {
   my $path = shift;
   print "-\r";
   print "/\r";
   print "\\\r";
   if ($path =~ m/$hostname/g){$size_cnt += -s $path;}
   @tmp_path = split('/',$path);
   $z = scalar(@tmp_path);
   if ($path =~ m/user.tab/g){
$f_date=get_file_date();
print DMN @tmp_path[scalar(@tmp_path)-2]."\t";
$count++;
print DMN $domain_size."\t";
$domain_size=0;
print DMN $mess_cnt."\t";
$mess_cnt=0;
print DMN $h_domain."\t";
print DMN $f_date."\n";
   } else {
if (($path =~ m/$hostname/g) and ($path !~ m/ipconn/g) and ($path !~ m/user.tab/g)){
    $domain_size += -s $path;
    $mess_cnt++;
}
   }
}
}
}


--------------------
________________________________________________________________________________

--= Running XMail Server 1.22 on Windows 2003 Virtual Server Since 16 August 2006 =--
[--- Ran Xmail on 2000 Server till Aug 2006 ---]
[--- 1.21 From 21 June 2005 till 15 Jan 2006---]
[--- 1.20 From 20 July 2004 till 21 June 2005---]
[--- 1.17 From 20 October 2003 till 20 July 2004---]
PMEmail Poster
Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
« Next Oldest | XMail Server | Next Newest »

Reply to this topicStart new topicStart Poll