2
#-------------------------------------------------------
3
# This script configures AWStats so that it works immediately.
4
# - Get Apache config file from registry (ask if not found)
5
# - Change common log to combined (ask to confirm)
6
# - Add AWStats directives
8
# - Create AWStats config file
9
# See COPYING.TXT file about AWStats GNU General Public License.
10
#-------------------------------------------------------
11
# $Revision: 1.4 $ - $Author: eldy $ - $Date: 2005/01/15 22:42:58 $
17
#-------------------------------------------------------
18
# IF YOU ARE A PACKAGE BUILDER, CHANGE THIS TO MATCH YOUR PATH
19
# SO THAT THE CONFIGURE WILL WORK ON YOUR DISTRIB !!!
20
# Following path are the one
21
#-------------------------------------------------------
32
$AWSTATS_ICON_PATH='/usr/local/awstats/wwwroot/icon';
33
$AWSTATS_CSS_PATH='/usr/local/awstats/wwwroot/css';
34
$AWSTATS_CLASSES_PATH='/usr/local/awstats/wwwroot/classes';
35
$AWSTATS_CGI_PATH='/usr/local/awstats/wwwroot/cgi-bin';
36
$AWSTATS_MODEL_CONFIG='/etc/awstats/awstats.model.conf'; # Used only when configure ran on linux
37
$AWSTATS_DIRDATA_PATH='/var/lib/awstats'; # Used only when configure ran on linux
41
#-------------------------------------------------------
43
#-------------------------------------------------------
44
# For windows registry management
46
eval('use Win32::TieRegistry ( Delimiter=>"/", TiedRef=>\$reg )');
48
use vars qw/ $REVISION $VERSION /;
49
$REVISION='$Revision: 1.4 $'; $REVISION =~ /\s(.*)\s/; $REVISION=$1;
50
$VERSION="1.0 (build $REVISION)";
53
$DIR $PROG $Extension $Debug
59
# Possible dirs for Apache conf files
61
'C:/Program Files/Apache Group/Apache2/conf/httpd.conf',
62
'C:/Program Files/Apache Group/Apache/conf/httpd.conf',
63
'/etc/httpd/httpd.conf',
64
'/usr/local/apache/conf/httpd.conf',
65
'/usr/local/apache2/conf/httpd.conf'
69
$WebServerChanged $UseAlias $Step
70
%LogFormat %ConfToChange
77
%OSLib=('linux'=>'Linux, BSD or Unix','macosx'=>'Mac OS','windows'=>'Windows');
82
#-------------------------------------------------------
84
#-------------------------------------------------------
86
#-------------------------------------------------------
88
#-------------------------------------------------------
90
print "Error: $_[0].\n";
94
#-------------------------------------------------------
96
#-------------------------------------------------------
98
my $level = $_[1] || 1;
99
if ($Debug >= $level) {
100
my $debugstring = $_[0];
101
if ($ENV{"GATEWAY_INTERFACE"}) { $debugstring =~ s/^ /   /; $debugstring .= "<br>"; }
102
print "DEBUG $level - ".time." : $debugstring\n";
107
#-------------------------------------------------------
108
# update_httpd_config
109
# Replace common to combined in Apache config file
110
#-------------------------------------------------------
111
sub update_httpd_config
114
if (! $file) { error("Call to update_httpd_config with wrong parameter"); }
116
open(FILE, $file) || error("Failed to open $file for update");
117
open(FILETMP, ">$file.tmp") || error("Failed to open $file.tmp for writing");
119
# $%conf contains param and values
123
# First, change values that are already present in old config file
130
# Remove comments not at beginning of line
134
if ($_ =~ /^CustomLog\s(.*)\scommon$/i) { $savline="CustomLog $1 combined"; }
137
print FILETMP "$savline";
143
# Move file to file.sav
144
if (rename("$file","$file.old")==0) {
145
error("Failed to make backup of current config file to $file.old");
148
# Move tmp file into config file
149
if (rename("$file.tmp","$file")==0) {
150
error("Failed to move tmp config file $file.tmp to $file");
156
#-------------------------------------------------------
157
# update_awstats_config
158
# Update an awstats model [to another one]
159
#-------------------------------------------------------
160
sub update_awstats_config
163
my $fileto=shift||"$file.tmp";
165
if (! $file) { error("Call to update_awstats_config with wrong parameter"); }
166
if ($file =~ /Developpements[\\\/]awstats/i) {
167
print " This is my dev area. Don't touch.\n";
169
} # To avoid script working in my dev area
171
open(FILE, $file) || error("Failed to open '$file' for read");
172
open(FILETMP, ">$fileto") || error("Failed to open '$fileto' for writing");
174
# $%conf contains param and values
178
# First, change values that are already present in old config file
185
# Remove comments not at beginning of line
188
# Extract param and value
189
my ($param,$value)=split(/=/,$_,2);
190
$param =~ s/^\s+//; $param =~ s/\s+$//;
192
$value =~ s/^[\s\'\"]+//; $value =~ s/[\s\'\"]+$//;
195
# cleanparam is param without begining #
196
my $cleanparam=$param; my $wascleaned=0;
197
if ($cleanparam =~ s/^#//) { $wascleaned=1; }
198
if (defined($ConfToChange{"$cleanparam"}) && $ConfToChange{"$cleanparam"}) { $savline = ($wascleaned?"#":"")."$cleanparam=\"".$ConfToChange{"$cleanparam"}."\"\n"; }
201
print FILETMP "$savline";
207
if ($fileto eq "$file.tmp") {
208
# Move file to file.sav
209
if (rename("$file","$file.old")==0) {
210
error("Failed to make backup of current config file to $file.old");
213
# Move tmp file into config file
214
if (rename("$fileto","$file")==0) {
215
error("Failed to move tmp config file $fileto to $file");
221
print " Config file $fileto created.\n";
228
#-------------------------------------------------------
230
#-------------------------------------------------------
231
($DIR=$0) =~ s/([^\/\\]+)$//; ($PROG=$1) =~ s/\.([^\.]*)$//; $Extension=$1;
232
$DIR||='.'; $DIR =~ s/([^\/\\])[\\\/]+$/$1/;
234
my $QueryString=""; for (0..@ARGV-1) { $QueryString .= "$ARGV[$_] "; }
235
if ($QueryString =~ /debug=/i) { $Debug=$QueryString; $Debug =~ s/.*debug=//; $Debug =~ s/&.*//; $Debug =~ s/ .*//; }
241
if ($ARGV[$_] =~ /^-*h/i) { $helpfound=1; last; }
242
if ($ARGV[$_] =~ /^-*awstatspath=([^\s\"]+)/i) { $AWSTATS_PATH=$1; last; }
244
# If AWSTATS_PATH was not forced on command line
245
if (! $AWSTATS_PATH) {
246
$AWSTATS_PATH=($DIR eq '.'?'..':$DIR);
247
$AWSTATS_PATH=~s/tools[\\\/]?$//;
248
$AWSTATS_PATH=~s/[\\\/]$//;
250
# On utilise le format de spearateur / partout (dans Apache et appels Perl)
251
$AWSTATS_PATH =~ s/\\/\//g;
255
print "----- AWStats $PROG $VERSION (c) Laurent Destailleur -----\n";
256
print "$PROG is a tool to setup AWStats. It works with Apache only.\n";
257
print " - Detect Apache config file (ask if not found)\n";
258
print " - Change common log to combined (ask to confirm)\n";
259
print " - Add AWStats directives\n";
260
print " - Restart web server\n";
261
print " - Create one AWStats config file (if asked)\n";
263
print "Usage: $PROG.$Extension\n";
270
my ($nowsec,$nowmin,$nowhour,$nowday,$nowmonth,$nowyear) = localtime($nowtime);
271
if ($nowyear < 100) { $nowyear+=2000; } else { $nowyear+=1900; }
272
my $nowsmallyear=$nowyear;$nowsmallyear =~ s/^..//;
273
if (++$nowmonth < 10) { $nowmonth = "0$nowmonth"; }
274
if ($nowday < 10) { $nowday = "0$nowday"; }
275
if ($nowhour < 10) { $nowhour = "0$nowhour"; }
276
if ($nowmin < 10) { $nowmin = "0$nowmin"; }
277
if ($nowsec < 10) { $nowsec = "0$nowsec"; }
280
print "----- AWStats $PROG $VERSION (c) Laurent Destailleur -----\n";
281
print "This tool will help you to configure AWStats to analyze statistics for\n";
282
print "one web server. You can try to use it to let it do all that is possible\n";
283
print "in AWStats setup, however following the step by step manual setup\n";
284
print "documentation (docs/index.html) is often a better idea. Above all if:\n";
285
print "- You are not an administrator user,\n";
286
print "- You want to analyze downloaded log files without web server,\n";
287
print "- You want to analyze mail or ftp log files instead of web log files,\n";
288
print "- You need to analyze load balanced servers log files,\n";
289
print "- You want to 'understand' all possible ways to use AWStats...\n";
290
print "Read the AWStats documentation (docs/index.html).\n";
294
if ("$^O" =~ /linux/i || (-d "/etc" && -d "/var" && "$^O" !~ /cygwin/i)) { $OS='linux'; $CR=''; }
295
elsif (-d "/etc" && -d "/Users") { $OS='macosx'; $CR=''; }
296
elsif ("$^O" =~ /cygwin/i || "$^O" =~ /win32/i) { $OS='windows'; $CR="\r"; }
298
print "configure.pl was not able to detect your OS. You must configure AWStats\n";
299
print "manually following the setup documentation (docs/index.html).\n";
300
print "configure.pl aborted.\n";
304
#print "Running OS detected: $OS (Perl $^[)\n";
305
print "\n-----> Running OS detected: $OSLib{$OS}\n";
307
if ($OS eq 'linux') {
308
$AWSTATS_PATH=`pwd`; $AWSTATS_PATH =~ s/[\r\n]//;
309
$AWSTATS_PATH=~s/tools[\\\/]?$//;
310
$AWSTATS_PATH=~s/[\\\/]$//;
311
if ($AWSTATS_PATH ne '/usr/local/awstats') {
312
print "Warning: AWStats standard directory on Linux OS is '/usr/local/awstats'.\n";
313
print "If you want to use standard directory, you should first move all content\n";
314
print "of AWStats distribution from current directory:\n";
315
print "$AWSTATS_PATH\n";
316
print "to standard directory:\n";
317
print "/usr/local/awstats\n";
318
print "And then, run configure.pl from this location.\n";
319
print "Do you want to continue setup from this NON standard directory [yN] ? ";
321
while ($bidon !~ /^[yN]/i) { $bidon=<STDIN>; }
322
if ($bidon !~ /^y/i) {
323
print "configure.pl aborted.\n";
326
$AWSTATS_ICON_PATH="$AWSTATS_PATH/wwwroot/icon";
327
$AWSTATS_CSS_PATH="$AWSTATS_PATH/wwwroot/css";
328
$AWSTATS_CLASSES_PATH="$AWSTATS_PATH/wwwroot/classes";
329
$AWSTATS_CGI_PATH="$AWSTATS_PATH/wwwroot/cgi-bin";
332
elsif ($OS eq 'macosx') {
333
$AWSTATS_PATH=`pwd`; $AWSTATS_PATH =~ s/[\r\n]//;
334
$AWSTATS_PATH=~s/tools[\\\/]?$//;
335
$AWSTATS_PATH=~s/[\\\/]$//;
336
if ($AWSTATS_PATH ne '/Library/WebServer/awstats') {
337
print "Warning: AWStats standard directory on Mac OS X is '/Library/WebServer/awstats'.\n";
338
print "If you want to use standard directory, you should first move all content\n";
339
print "of AWStats distribution from current directory:\n";
340
print "$AWSTATS_PATH\n";
341
print "to standard directory:\n";
342
print "/Library/WebServer/awstats\n";
343
print "And then, run configure.pl from this location.\n";
344
print "Do you want to continue setup from this NON standard directory [yN] ? ";
346
while ($bidon !~ /^[yN]/i) { $bidon=<STDIN>; }
347
if ($bidon !~ /^y/i) {
348
print "configure.pl aborted.\n";
351
$AWSTATS_ICON_PATH="$AWSTATS_PATH/wwwroot/icon";
352
$AWSTATS_CSS_PATH="$AWSTATS_PATH/wwwroot/css";
353
$AWSTATS_CLASSES_PATH="$AWSTATS_PATH/wwwroot/classes";
354
$AWSTATS_CGI_PATH="$AWSTATS_PATH/wwwroot/cgi-bin";
357
elsif ($OS eq 'windows') {
358
# We do not use default values for awstats directives
359
# but thoose defined from AWSTATS_PATH
360
$AWSTATS_ICON_PATH="$AWSTATS_PATH/wwwroot/icon";
361
$AWSTATS_CSS_PATH="$AWSTATS_PATH/wwwroot/css";
362
$AWSTATS_CLASSES_PATH="$AWSTATS_PATH/wwwroot/classes";
363
$AWSTATS_CGI_PATH="$AWSTATS_PATH/wwwroot/cgi-bin";
368
# Detect web server path
369
# ----------------------
370
print "\n-----> Check for web server install\n";
371
my %ApachePath=(); # All Apache path found (used on windows only)
372
my %ApacheConfPath=(); # All Apache config found
374
if ($OS eq 'linux' || $OS eq 'macosx') {
376
foreach my $conf (@WEBCONF) {
378
print " Found Web server Apache config file '$conf'\n";
379
$ApacheConfPath{"$conf"}=++$found;
383
if ($OS eq 'windows' && "$^O" !~ /cygwin/i) {
384
$reg->Delimiter("/");
385
if ($tips=$reg->{"LMachine/Software/Apache Group/Apache/"}) {
386
# If Apache registry call successfull
388
foreach( sort keys %$tips ) {
389
my $path=$reg->{"LMachine/Software/Apache Group/Apache/$_/ServerRoot"};
391
if (-d "$path" && -s "$path/conf/httpd.conf") {
392
print " Found a Web server Apache install in '$path'\n";
393
$ApachePath{"$path"}=++$found;
394
$ApacheConfPath{"$path/conf/httpd.conf"}=++$found;
399
if (! scalar keys %ApacheConfPath) {
402
if ($OS eq 'windows') {
403
# Ask web server path (need to restart on windows)
404
print "$PROG did not find your Apache web main runtime.\n";
406
print "\nPlease, enter full directory path of your Apache web server or\n";
407
print "'none' to skip this step if you don't have local web server or\n";
408
print "don't have permission to change its setup.\n";
409
print "Example: c:\\Program files\\apache group\\apache\n";
410
while ($bidon ne 'none' && ! -d "$bidon") {
411
print "Apache Web server path ('none' to skip):\n> ";
412
$bidon=<STDIN>; chomp $bidon;
413
if ($bidon && ! -d "$bidon" && $bidon ne 'none') { print "- The directory '$bidon' does not exists.\n"; }
417
if ($bidon ne 'none') {
418
if ($bidon) { $ApachePath{"$bidon"}=1; }
420
print "\n".($bidon?"Now, enter":"Enter")." full config file path of your Web server.\n";
421
print "Example: /etc/httpd/httpd.conf\n";
422
print "Example: /usr/local/apache2/conf/httpd.conf\n";
423
print "Example: c:\\Program files\\apache group\\apache\\conf\\httpd.conf\n";
425
while ($bidon ne 'none' && ! -f "$bidon") {
426
print "Config file path ('none' to skip web server setup):\n> ";
427
$bidon=<STDIN>; chomp $bidon;
428
if ($bidon && ! -f "$bidon" && $bidon ne 'none') { print "- This file does not exists.\n"; }
430
if ($bidon ne 'none') {
431
$ApacheConfPath{"$bidon"}=1;
437
if (! scalar keys %ApacheConfPath) {
439
print "Your web server config file(s) could not be found.\n";
440
print "You will need to setup your web server manually to declare AWStats\n";
441
print "script as a CGI, if you want to build reports dynamically.\n";
442
print "See AWStats setup documentation (file docs/index.html)";
446
# Open Apache config file
447
# -----------------------
448
foreach my $key (keys %ApacheConfPath) {
449
print "\n-----> Check and complete web server config file '$key'\n";
450
# Read config file to search for awstats directives
451
my $commonchangedtocombined=0;
454
open(CONF,"<$key") || error("Failed to open config file '$key' for reading");
456
my $awstatsjsfound=0;
457
my $awstatsclassesfound=0;
458
my $awstatscssfound=0;
459
my $awstatsiconsfound=0;
460
my $awstatscgifound=0;
461
my $awstatsdirectoryfound=0;
463
if ($_ =~ /^CustomLog\s(.*)\scommon$/i) {
464
print "Warning: You Apache config file contains directives to write 'common' log files\n";
465
print "This means that some features can't work (os, browsers and keywords detection).\n";
466
print "Do you want me to setup Apache to write 'combined' log files [y/N] ? ";
468
while ($bidon !~ /^[yN]/i) { $bidon=<STDIN>; }
469
if ($bidon =~ /^y/i) {
471
update_httpd_config("$key");
473
$commonchangedtocombined=1;
477
if ($_ =~ /^CustomLog\s(.*)\scombined$/i) { $LogFormat{$key}=1; }
478
if ($_ =~ /Alias \/awstatsclasses/) { $awstatsclassesfound=1; }
479
if ($_ =~ /Alias \/awstatscss/) { $awstatscssfound=1; }
480
if ($_ =~ /Alias \/awstatsicons/) { $awstatsiconsfound=1; }
481
if ($_ =~ /ScriptAlias \/awstats\//) { $awstatscgifound=1; }
482
my $awstats_path_quoted=quotemeta($AWSTATS_PATH);
483
if ($_ =~ /Directory "$awstats_path_quoted\/wwwroot"/) { $awstatsdirectoryfound=1; }
487
if ($awstatsclassesfound && $awstatscssfound && $awstatsiconsfound && $awstatscgifound && $awstatsdirectoryfound) {
489
if ($commonchangedtocombined) { print " Common log files changed to combined.\n"; }
490
print " AWStats directives already present.\n";
494
# Add awstats directives
495
open(CONF,">>$key") || error("Failed to open config file '$key' for adding AWStats directives");
497
if (! $awstatsclassesfound || ! $awstatscssfound || ! $awstatsiconsfound || ! $awstatscgifound) {
500
print CONF "# Directives to allow use of AWStats as a CGI$CR\n";
503
if (! $awstatsclassesfound) {
504
print " Add 'Alias \/awstatsclasses \"$AWSTATS_CLASSES_PATH\/\"'\n";
505
print CONF "Alias \/awstatsclasses \"$AWSTATS_CLASSES_PATH\/\"$CR\n";
507
if (! $awstatscssfound) {
508
print " Add 'Alias \/awstatscss \"$AWSTATS_CSS_PATH\/\"'\n";
509
print CONF "Alias \/awstatscss \"$AWSTATS_CSS_PATH\/\"$CR\n";
511
if (! $awstatsiconsfound) {
512
print " Add 'Alias \/awstatsicons \"$AWSTATS_ICON_PATH\/\"'\n";
513
print CONF "Alias \/awstatsicons \"$AWSTATS_ICON_PATH\/\"$CR\n";
515
if (! $awstatscgifound) {
516
print " Add 'ScriptAlias \/awstats\/ \"$AWSTATS_CGI_PATH\/\"'\n";
517
print CONF "ScriptAlias \/awstats\/ \"$AWSTATS_CGI_PATH\/\"$CR\n";
519
if (! $awstatsdirectoryfound) {
520
print " Add '<Directory>' directive\n";
524
# This is to permit URL access to scripts/files in AWStats directory.
526
<Directory "$AWSTATS_PATH/wwwroot">
538
print " AWStats directives added to Apache config file.\n";
541
# Define model config file path
542
# -----------------------------
544
if ($OS eq 'linux') {
545
if (-f "$AWSTATS_PATH/wwwroot/cgi-bin/awstats.model.conf") {
546
$modelfile="$AWSTATS_PATH/wwwroot/cgi-bin/awstats.model.conf";
549
$modelfile="$AWSTATS_MODEL_CONFIG";
550
if (! -s $modelfile || ! -w $modelfile) { $modelfile="$AWSTATS_PATH/wwwroot/cgi-bin/awstats.model.conf"; }
553
elsif ($OS eq "macosx") {
554
$modelfile="$AWSTATS_PATH/wwwroot/cgi-bin/awstats.model.conf";
556
elsif ($OS eq 'windows') { $modelfile="$AWSTATS_PATH\\wwwroot\\cgi-bin\\awstats.model.conf"; }
557
else { $modelfile="$AWSTATS_PATH\\wwwroot\\cgi-bin\\awstats.model.conf"; }
559
# Update model config file
560
# ------------------------
561
if (-s $modelfile && -w $modelfile) {
562
print "\n-----> Update model config file '$modelfile'\n";
564
if ($OS eq 'linux' || $OS eq "macosx") { $ConfToChange{'DirData'}="$AWSTATS_DIRDATA_PATH"; }
565
elsif ($OS eq 'windows') { $ConfToChange{'DirData'}='.'; }
566
else { $ConfToChange{'DirData'}='.'; }
568
$ConfToChange{'DirCgi'}='/awstats';
569
$ConfToChange{'DirIcons'}='/awstatsicons';
571
update_awstats_config("$modelfile");
572
print " File awstats.model.conf updated.\n";
575
# Ask if we need to create a config file
576
#---------------------------------------
579
print "\n-----> Need to create a new config file ?\n";
580
print "Do you want me to build a new AWStats config/profile\n";
581
print "file (required if first install) [y/N] ? ";
583
while ($bidon !~ /^[yN]/i) { $bidon=<STDIN>; }
584
if ($bidon =~ /^y/i) {
586
# Ask value for web site name
587
#----------------------------
588
print "\n-----> Define config file name to create\n";
589
print "What is the name of your web site or profile analysis ?\n";
590
# TODO Add example that use value found in ServerName ?
591
print "Example: www.mysite.com\n";
592
print "Example: demo\n";
596
print "Your web site, virtual server or profile name:\n> ";
597
$bidon=<STDIN>; chomp $bidon;
598
if ($bidon =~ /\s/) { print " Space chars are not allowed.\n"; $bidon=''; }
602
# Define config file path
603
# -----------------------
604
if ($OS eq 'linux') {
605
print "\n-----> Define config file path\n";
606
print "In which directory do you plan to store your config file(s) ?\n";
607
print "Default: /etc/awstats\n";
609
print "Directory path to store config file(s) (Enter for default):\n> ";
610
$bidon=<STDIN>; chomp $bidon;
611
if (! $bidon) { $bidon = "/etc/awstats"; }
612
my $configdir=$bidon;
613
if (! -d $configdir) {
614
# Create the directory for config files
615
my $mkdirok=mkdir "$configdir", 0755;
616
if (! $mkdirok) { error("Failed to create directory '$configdir', required to store config files."); }
618
$configfile="$configdir/awstats.$site.conf";
620
elsif ($OS eq "macosx") { $configfile="$AWSTATS_PATH/wwwroot/cgi-bin/awstats.$site.conf"; }
621
elsif ($OS eq 'windows') { $configfile="$AWSTATS_PATH\\wwwroot\\cgi-bin\\awstats.$site.conf"; }
622
else { $configfile="$AWSTATS_PATH\\wwwroot\\cgi-bin\\awstats.$site.conf"; }
624
if (-s "$configfile") {
625
print "Warning: A config file for this name already exists. Choose another one.\n";
629
# Create awstats.conf file
630
# ------------------------
631
print "\n-----> Create config file '$configfile'\n";
632
if (-s $configfile) { print " Config file already exists. No overwrite possible on existing config files.\n"; }
635
# TODO Ask path of log file to change LogFile parameter
636
if ($OS eq 'linux' || $OS eq "macosx") { $ConfToChange{'DirData'}="$AWSTATS_DIRDATA_PATH"; }
637
if ($OS eq 'windows') { $ConfToChange{'DirData'}='.'; }
639
$ConfToChange{'DirCgi'}='/awstats';
640
$ConfToChange{'DirIcons'}='/awstatsicons';
642
$ConfToChange{'SiteDomain'}="$site";
643
my $sitewithoutwww=lc($site); $sitewithoutwww =~ s/^www\.//i;
644
$ConfToChange{'HostAliases'}="$sitewithoutwww www.$sitewithoutwww 127.0.0.1 localhost";
645
update_awstats_config("$modelfile","$configfile");
651
# Restart Apache if change were made
652
# ----------------------------------
653
if ($WebServerChanged) {
654
if ($OS eq 'linux') {
655
if (-f "/etc/debian_version") {
657
my $command="/etc/init.d/apache restart";
658
print "\n-----> Restart Web server with '$command'\n";
661
} elsif (-x "/sbin/service") {
662
# We are not on debian
663
my $command="/sbin/service httpd restart";
664
print "\n-----> Restart Web server with '$command'\n";
668
print "\n-----> Don't forget to restart manually your web server\n";
671
elsif ($OS eq 'macosx') {
672
print "\n-----> Restart Web server with '/usr/sbin/apachectl restart'\n";
673
my $ret=`/usr/sbin/apachectl restart`;
676
elsif ($OS eq 'windows') {
677
foreach my $key (keys %ApachePath) {
678
if (-f "$key/bin/Apache.exe") {
679
print "\n-----> Restart Apache with '\"$key/bin/Apache.exe\" -k restart'\n";
680
my $ret=`"$key/bin/Apache.exe" -k restart`;
685
foreach my $key (keys %ApachePath) {
686
if (-f "$key/bin/Apache.exe") {
687
print "\n-----> Restart Apache with '\"$key/bin/Apache.exe\" -k restart'\n";
688
my $ret=`"$key/bin/Apache.exe" -k restart`;
696
# Scan logorate for a log file
697
# If apache log has a logrotate log found, we create a config and add line in prerotate
704
# Schedule awstats update process
705
# -------------------------------
706
print "\n-----> Add update process inside a scheduler\n";
707
if ($OS eq 'linux' || $OS eq "macosx") {
708
print "Sorry, configure.pl does not support automatic add to cron yet.\n";
709
print "You can do it manually by adding the following command to your cron:\n";
710
print "$AWSTATS_CGI_PATH/awstats.pl -update -config=".($site?$site:"myvirtualserver")."\n";
711
print "Or if you have several config files and prefer having only one command:\n";
712
print "$AWSTATS_PATH/tools/awstats_updateall.pl now\n";
713
print "Press ENTER to continue... ";
716
elsif ($OS eq 'windows') {
717
print "Sorry, for Windows users, if you want to have statistics to be\n";
718
print "updated on a regular basis, you have to add the update process\n";
719
print "in a scheduler task manually (See AWStats docs/index.html).\n";
720
print "Press ENTER to continue... ";
724
print "Sorry, if you want to have statistics to be\n";
725
print "updated on a regular basis, you have to add the update process\n";
726
print "in a scheduler task manually (See AWStats docs/index.html).\n";
727
print "Press ENTER to continue... ";
731
#print "\n-----> End of configuration\n";
734
print "A SIMPLE config file has been created: $configfile\n";
735
print "You should have a look inside to check and change manually main parameters.\n";
736
print "You can then manually update your statistics for '$site' with command:\n";
737
print "> perl awstats.pl -update -config=$site\n";
738
if (scalar keys %ApacheConfPath) {
739
print "You can also read your statistics for '$site' with URL:\n";
740
print "> http://localhost/awstats/awstats.pl?config=$site\n";
743
print "You can also build static report pages for '$site' with command:\n";
744
print "> perl awstats.pl -output=pagetype -config=$site\n";
749
print "No config file was built. You can run this tool later to build as\n";
750
print "much config/profile files as you want.\n";
751
print "Once you have a config/profile file, for example 'awstats.demo.conf',\n";
752
print "You can manually update your statistics for 'demo' with command:\n";
753
print "> perl awstats.pl -update -config=demo\n";
754
if (scalar keys %ApacheConfPath) {
755
print "You can also read your statistics for 'demo' with URL:\n";
756
print "> http://localhost/awstats/awstats.pl?config=demo\n";
759
print "You can also build static report pages for 'demo' with command:\n";
760
print "> perl awstats.pl -output=pagetype -config=demo\n";
764
print "Press ENTER to finish...\n";
768
0; # Do not remove this line