Dear Sirs!
I've been using awstats for a time, with one of it's tools, called awstats_buildstaticpages.pl. Because the virtualmin plugin didn't contained it (or just I couldn't find it), I already copied from another server.
My only problem is, that I can't resolve, how can I add this feature for a domain, created with Virtualmin.
I've been looking through the code of virtualmin-awstats-lib.pl, and I've found some lines: [code:1]
generate_report(domain, handle, html-escape?) Updates the AWstats report for a particular domain, from all of its log files (or at least those that have changed since the last run)sub generate_report { local ($dom, $fh, $esc) = @_; local $user = &get_run_user($dom); local $cmd = "$config{'awstats'} -config=$dom -update"; $ENV{'GATEWAY_INTERFACE'} = undef; [/code:1]
Can I add a piece of code somehow to manage to build static pages? I don't want to make this script collapse, so I was afraid to modify it, please help me.
Best regards, Peter
@cadeyrn Did you find a solution to this? If yes, could you please share it.
Thanks
Hello,
I know it is an old question, but I just want to share the little "hacks" i've done in order to solve this issue. Hope it can help someone AND/OR virtualmin developers will consider to add in the official distribution AND/OR i can find the time to submit a proper patch:
1) modify the webmin-awstats.pl script (usually you can find it in: /etc/webmin/webmin-awstats.pl) as follows:
=== BEGIN OF webmin_awstats.pl patch ===
#!/usr/bin/perl
open(CONF, "/etc/webmin/miniserv.conf");
while(<CONF>) {
$root = $1 if (/^root=(.*)/);
}
close(CONF);
$ENV{'PERLLIB'} = "$root";
$ENV{'WEBMIN_CONFIG'} = "/etc/webmin";
$ENV{'WEBMIN_VAR'} = "/var/webmin";
chdir("$root/virtualmin-awstats");
#print "eseguo awstats.pl...\n";
system("$root/virtualmin-awstats/awstats.pl", @ARGV); # || die "Failed to run $root/virtualmin-awstats/awstats.pl : $!";
$domain_name = @ARGV[0];
$domain_awstats_dir="/var/www/vhosts/$domain_name/statistics/webstat/";
$index_path="awstats.$domain_name.html";
$awstats_build="/usr/share/awstats/tools/awstats_buildstaticpages.pl -config=$domain_name";
# create dest directory and all its parents ...
system("mkdir -p $domain_awstats_dir");
chdir("$domain_awstats_dir");
system($awstats_build); # || die "Error invoking 'awstats_buildstaticpages.pl': $!";
system("ln -fs $index_path index.html");
=== END OF webmin_awstats.pl patch ===
(please, note that the exec(...) invocation have has been replaced with system, in order to continue in the execution after the first command ...)
2) add to your virtual host configuration an entry such as the following:
Alias /statistics/webstat /var/www/vhosts/<your_domain_name>/statistics/webstat
3) now you should be able to access your statistics via webbroser using the following url:
http://www.<your_domain_name>/statistics/webstat
Hope it helps, and I'm open to further suggestions :)