Ugly and in perl ;)
use strict;
use constant ONE_DAY => 60*60*24;
my ($s,$m,$h,$day,$month,$year,$wd,$yd,$dst);
my $key;
my ($value,$monthstr,$daystr);
my $yesterday = time () - ONE_DAY;
($s,$m,$h,$day,$month,$year,$wd,$yd,$dst) = localtime($yesterday);
$month++;
if ($month < 10) {$monthstr = "0$month"} else {$monthstr = "$month"};
if ($day < 10) {$daystr = "0$day"} else {$daystr = "$day"};
$year = $year + 1900;
print "\n$day,$monthstr,$year\n";
my %hosts =(
example=>'example.com',
);
my %stats_dirs=(
example=>'/stats_dir/webdruid',
);
while (($key, $value) = each(%stats_dirs))
{
my $LogFile;
#print("$key = $value\n");
#print("$key = $hosts{$key}\n");
#print("$key = $stats_dirs{$key}\n");
$LogFile = "/opt/Apache/logs/$key"."_access$year$monthstr$daystr.log";
print "$LogFile\n";
system("logresolve <$LogFile >$LogFile". "resolved");
system("webdruid -c webdruid_example.conf -o $stats_dirs{$key} $LogFile"."resolved");
system("rm $LogFile". "resolved");
}
linux
1 comment:
OMG !
Post a Comment