[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-users] Webalizer & Logrotate, lets try it again...



Steven..

>Webalizer
>is supposed to handle the logs in the compressed (gzipped) state with no
>manual in
>the package installation check webalizer.com for the online version.

Got it, just printed it and will read it in a little bit

>Is your webalizer.conf file at /etc/webalizer.conf?  It should be unless the
>.pl

Yes that's where it is

>use different conf files for each virtual site.  I imagine the webalizer.pl
>file

At this point.. hell, everyone gets what they get :) Let on conf handle the whole shebang :)

>contains a number of lines with a component similar to:
>
>/usr/local/bin/webalizer -Q -n www.domain.com -o /home/sites/site1/stats \

Nope.. webalizer.pl (which lives in /etc/cron.daily)

#!/usr/bin/perl

# This script runs webalizer for every virtual site on a Cobalt RaQ3
# machine.  This depends on the configuration file /etc/webalizer.conf
# and several command-line switches including those for the LogFile and
# Hostname.

# Where sites on a RaQ3 live
$prefix = "/home/sites";
# Status messages
my $messages;

chdir "$prefix" or die "Can't cd to $prefix??: $!\n";
opendir THEROOT, $prefix or die "Couldn't open $prefix?: $!\n";
@allsites = grep !/^\.\.?$/,  readdir THEROOT;

foreach $asite (@allsites)
{
 if (-l "$asite")
  {
    $thepath = "$prefix/$asite/web/stats";
    # Create a directory /web/stats if it isn't there yet
    mkdir $thepath, 775  unless (-d $thepath);
    chown 0, 0, $thepath;
    chmod 0755, $thepath;
    $messages .=
       `webalizer -n $asite -q -T -o $thepath $prefix/$asite/logs/web.log`;
  }
}
# Debugging printer, uncomment to use.
# print $messages;
exit 0;

That's the whole script.. process sitex/logs/web.log and write to sitex/web/stats creates that if it doesn't exist.

>The -p switch is added in this line.  "man webalizer" and webalizer --help

So I need to call the webalizer.pl as it sites in the cron.daily (or elsewhere's) with the -p switch

Right now its just being called with no switches as part of the run-parts cron.daily in the crontab

>> I never saw the "run-parts" in a cron before.. I assume it runs everything
>> in that directory?? That's what it means?

>Exactly.  It's pretty useful if you have a lot of scripts you want to run
>from a
>crontab at the same time.

If I add a line to root's crontab to call it with the switch as it sits in cron.daily, I'm bright enough to know it will actually get called 2x's.. once as cron.daily and once stand alone with the -p. so that's not a good idea IMHO :)

So I'm seriously leaning toward copying the .pl to usr/sbin I guess not sure.. remove it from cron.daily and add a line to the crontab, but again I need the proper syntax for the call with a switch..

10 4 * * * root  /usr/sbin/webalizer.pl -p

at 10 minutes past 4a, a few minutes after the others do their thing in cron.daily. The output so far was time stamped at 8-12 minutes past 4a so 10 after 4 should be very safe.. or am I better off calling it before the rotate?

>> Thanks... learning new stuff every day.. frustrating but rewarding :)
>
>So, what did you learn at school today?  <smile>

That my head hurts from all this :)

Regards,
Debbie  ^v^   ///\o/\\\    ^v^
webmaster@xxxxxxxxxxxxxx (AIM NailGdsss  ICQ 354179)
WWWeb Services, Ronkonkoma, NY
877-669-7953 - voicemail/fax
BeautyTech / SalonMart
http://beautytech.com/   http://salonmart.com