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

C-shell script



The difference between this one and the previous one is that the
previous script (Perl) allowed you to gather several statistics,
and would determine automatically the name of the stats file according
to the rule we defined: 

>>Architecture is in: /VIRTUALLIB/arch.html
>>so the stat file would be: /VIRTUALLIB/stat.arch.html
>>Lan. Arch is in: /VIRTUALLIB/larch.html
>>so the stat file would be: /VIRTUALLIB/stat.larch.html
>
>OK. And for me, with a URL that ends in /, then just "stat" would be my name.

Here, you have to define the name of your stats file, just as in Dave's
script. 

--> I would advise you to use this script rather than the perl one I wrote
--> before if you just want the statistics of one document.




----------------------- Cut here -------------------------------------------
#! /bin/csh
#
# Author: Arthur Secret (secret@w3.org)
#
# This file is available at
# http://info.cern.ch/hypertext/DataSources/bySubject/vl_stats.script
#
# It counts the number of times a specific document has been accessed
# during the day it is run. Therefore, this script should be included in a
# crontab file to run at 11:55 pm each day, eg with the line
#
# 23 55 * * * /home/secret/hypertext/DataSources/bySubject/vl_stats.script
#
##################
# Customization: #
##################
# 
# this script is less intelligent than the perl script
# vl_stats.pl, so you can only process one file at a time
# 
#
set url = '/hypertext/DataSources/bySubject/Overview.html'
set stat = '/home/secret/test/httpd-log-txt.9412'
#
# You must define the 'results' variable according to the following rule:
#
# >Architecture is in: /VIRTUALLIB/arch.html
# >so the stat file would be: /VIRTUALLIB/stat.arch.html
# >Lan. Arch is in: /VIRTUALLIB/larch.html
# >so the stat file would be: /VIRTUALLIB/stat.larch.html
#
# OK. And for me, with a URL that ends in /, then just "stat" would be my name.
#
set results = '/home/secret/hypertext/DataSources/bySubject/stat.Overview.html'

############################
# Beginning of the program #
############################

set date = `date +%d/%b/%Y`
set number = `cat $stat | egrep "GET $url " | egrep "$date" | wc -l`
cp /dev/null $results
echo "Version: 1.0" >> $results
echo " " >> $results
echo "Today ($date) access: $number" >> $results

----------------------------- Cut here -------------------------------------