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

[cobalt-users] Re: Webalizer Cron



I put the following file in my /etc/cron.daily directory (I found it
somewhere called webalizer.sh - I had to tweak it a little to make it work
on the RAQ3 I administer). It is a little slow to work, but... it works -
for proof, check out http://www.occa.co.uk/stats :)

Hope this helps :)

Jon Spriggs
--
Tech Support, Webmaster and Server manager for Tawney Ltd

FILE NAME: webalizer.modified.sh

#!/bin/sh
#
# Jeremy Hansen <jeremy@xxxxxxxxxxxx>  June 1, 1998
# Jon Spriggs <jon@xxxxxxxxxxxxxx> modified 02-04-2001
#
# Simple shell script to process large amounts
# of access_logs.  This of course will only
# work if your setup is exactly like mine.  If not,
# this will give you an idea how to do things
# for your setup.
#
# This was working with the RAQ3 machines, and required a little
# tinkering to get it to work with my limited knowledge of log
# rotations, and script authoring
#
# If anyone can make any better suggestions, please don't hesitate
# to tell me how! :) All comments to jon@xxxxxxxxxxxxxx

ls /home/sites/ > /tmp/$$1.www_servers

# LiSts the directories in this path to the mentioned file

cat /tmp/$$1.www_servers |grep -v 'site' >/tmp/$$2.www_servers
cat /tmp/$$2.www_servers |grep -v 'home' >/tmp/$$.www_servers

# Parse the mentioned file to strip out the word site and the word
# home. The reason? Directories with the word "site" will never be
# called directly, neither will those called home... in theory :)

# For each listing in /home/sites, process using webalizer.
# Test for the existance of /home/sites/*/logs.  If
# it doesn't exist, create it.

SERVER=`cat /tmp/$$.www_servers`

# Read the values of the directory listing into the value "SERVER"

for i in $SERVER
   do

# Split the entries in that SERVER variable and call it I

      if [ -d /home/sites/$i/web/stats ]; then

# If there is a directory called /home/sites/your.domain.com/web/stats

      cat /var/log/httpd/access | grep $i >/home/sites/$i/logs/web.log

# Read the entries from the access file and store them in a web.log
# file in the logs area.

         /usr/bin/webalizer -d -n $i -o /home/sites/$i/web/stats \
         /home/sites/$i/logs/web.log

# Use Webalizer to process the log file we just created (the backslash
# at the end seems to make it run over two or more lines

      else
         mkdir /home/sites/$i/web
         mkdir /home/sites/$i/web/stats

# Otherwise, make the directory first, and then

      cat /var/log/httpd/access | grep $i >/home/sites/$i/logs/web.log


# Read the entries from the access file and store them in a web.log
# file in the logs area.

         /usr/bin/webalizer -d -n $i -o /home/sites/$i/web/stats \
         /home/sites/$i/logs/web.log

# Use Webalizer to process the log file we just created (the backslash
# at the end seems to make it run over two or more lines

      fi
done

rm /tmp/$$*.www_servers

# Remove the temporary files

# fin

ORIGINAL MESSAGE BELOW:

--__--__--

Message: 16
From: "Colin Jack" <colin@xxxxxxxxxxxxxx>
To: <cobalt-users@xxxxxxxxxxxxxxx>
Date: Fri, 4 May 2001 15:09:31 +0100
Subject: [cobalt-users] RE:Using Webalizer
Reply-To: cobalt-users@xxxxxxxxxxxxxxx


run from shell:
/usr/bin/webalizer2.pl

The first run will take some time...

You might want to get webalizer starting regularly and automatically?
This is a so-called cron job.

Please search the list archives on 'cron jobs'. There might be a much better
description than I can give at the moment.

HTH


Regards,

Hendrik
--

Thanks for that - except that I now have a screen full of error messages:

Can't open log file /home/sites/domainname/logs/web.log

What do I need to turn on :)

Colin

------------------------------ disclaimer ---------------------------------

This e-mail and any attachments are confidential & access by anyone other
than the addressee(s) is unauthorised. The security of e-mail communication
cannot be guaranteed and neither Mainline IT nor Mainline Internet will
accept claims arising as a result of using this medium.
Any opinions expressed herein are the opinions of the author and are not
those of either Mainline IT or Mainline Internet.
Although all email is scanned for viruses, it is the responsibility of the
recipient to ensure they have adequate anti-virus defences.

---------------------------------------------------------------------------



---
The ABT Group use AVG to certify that the outgoing e-mails are virus free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.243 / Virus Database: 118 - Release Date: 30/03/2001