sub gen_stats { my($log); my($domain); # Generate stats for the entire server (server wide) system($webalizer, "-q", "-D", $work_dir."/dns_cache.db", "-N", "20", "-n", $server_hostname, "-o", $server_log_dir, $access_log); opendir(WORKDIR, $work_dir) or die "Could not open $work_dir: $!\n"; while (defined($log = readdir(WORKDIR))) { # If the file isn't . or .. then strip off the .log portion to get just the host # + domain. Run webalizer using log file. if ($log !~ /^\.\.?$/ and $log !~ /dns_cache\.db/) { ($domain) = split(/\.log/, $log); # IF the web stats directory doesn't exist, don't bother running stats for # that particular web. if ( -e "$stats_dir/$domain" ) { system($webalizer, "-q", "-D", $work_dir."/dns_cache.db", "-N", "20", "-n", $domain, "-o", $stats_dir."/".$domain, $work_dir."/".$log); } else { print "Stats directory for $domain doesn't exist.\n"; } } } closedir WORKDIR; }