Anonymous
public text v1 · immutable
sub getstats
{
my ($host) = @_;
my $tmpdir = "/tmp/";
my $domain = $host . ".foobar.com";
my $asdir = "/var/lib/awstats/";
my $asfile = "awstats$date.$domain.txt";
my $astmp = $tmpdir . $asfile;
my $awstats = $asdir . $asfile;
system("rsync -av $host:$awstats $tmpdir");
tie my @awstats, 'Tie::File', $astmp or die "Can't open $astmp: $!\n";
for my $line ( @awstats )
{
if ( $line =~ /BEGIN_SIDER\s/ )
{
splice @awstats, 0, ( $i + 1 );
last;
}
$i++;
}
untie @awstats;