[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [cobalt-users] Webalizer & Logrotate, lets try it again...
- Subject: Re: [cobalt-users] Webalizer & Logrotate, lets try it again...
- From: "Steven Werby" <steven-lists@xxxxxxxxxxxx>
- Date: Tue Jul 18 21:23:18 2000
Debbie Doerrlamm <wkdwich@xxxxxxxxxxxx> wrote:
> At this point.. hell, everyone gets what they get :) Let on conf handle the
> whole shebang :)
LOL. Reminds me of a visit to Wendy's (a fast-food restaurant for the non-US
readers). I had already sat down so I asked my friend to get me a few ketchup
packets. Realizing "few" was a little vague, I asked my friend to get me 5 packets.
The cashier heard me and yelled back "your friend will get what I give him". I only
got 3 packets. <frown> I have yet to have a user request a change to the Webalizer
stats (probably b/c they don't know they can), but I have a couple of sites where I
want to group referrers differently, ingnore referrals generated from the site being
analyzed, show a complete list of all pages viewed, etc. in which case I use a custom
conf file.
> >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`;
Looks like you want to add the -p option to the line above. Read the manual and see
if there are any other modifications you might want to make to the line above. It's
too bad the above script doesn't allow for the /stats directory's ownership to be
configured and the /stats directory to be password-protected with access granted to
users and/or groups specified by the serveradmin. Of course, this would require a
plug-in for the GUI and more code, but that's how I do it in the bash (commandline)
script I wrote. Then again, this is totally automated and seems to do a good job at
what it's designed to do (I haven't touched it, just my observation based on code and
description of functionality).
> 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
After looking at the Perl code it appears the only place you can apply the -p switch
is where I mentioned earlier.
> 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 :)
You're correct - it would run twice. You have to actually edit the line I mentioned
to add the -p flag so you can't really add the -p flag directly to the cron entry.
> 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
Won't work unless the author modifies the code, but that's not really necessary.
You're correct about how cron and crontab work though and that you would need to
delete the current file from cron.daily if you're going to put it in root's crontab.
FYI, I prefer to put in root's crontab since I have control over when the script is
run w/out changing when cron.daily is executed.
> >So, what did you learn at school today? <smile>
>
> That my head hurts from all this :)
I recommend ibuprofen or Captain Morgan's...or ibuprofen after Captain Morgan's.
YMMV.
Steven Werby {steven-lists@xxxxxxxxxxxx}