Page MenuHomec4science

webstat.in
No OneTemporary

File Metadata

Created
Wed, Jul 3, 20:38

webstat.in

## $Id$
## WebStat -- analyze httpd log file to get some usage stats.
## This file is part of the CERN Document Server Software (CDSware).
## Copyright (C) 2002, 2003, 2004, 2005 CERN.
##
## The CDSware is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your option) any later version.
##
## The CDSware is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with CDSware; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
## read config variables:
#include "config.wml"
#include "configbis.wml"
#include "cdswmllib.wml"
## start shell:
<protect>#!/bin/sh
<protect>## Do not edit this file -- it was generated from CDSware WML sources. Edit those instead.</protect>
## fill config variables:
LISPIMAGEDIR=<LIBDIR>/lisp/cdsware
CONFIGDIR=<ETCDIR>/webstat
## do we have enough arguments?
if [ ! -n "$1" ]; then
echo "Error: Not enough arguments."
echo "Usage:" $0 "<httpd-log-file>"
exit 1
fi
## are input files okay?
FILECFG=${CONFIGDIR}/webstat.cfg
FILELOG=$1
if [ ! -f $FILECFG ]; then
echo "Error: config file ${FILECFG} not found."
echo "Usage:" $0 "<httpd-log-file>"
exit 1
fi
if [ ! -f $FILELOG ]; then
echo "Error: httpd log file not found."
echo "Usage:" $0 "<httpd-log-file>"
exit 1
fi
## check which Common Lisp implementation to use?
if [ "$LISP" == "" ]; then
LISP=lisp
if [ ! -e ${LISPIMAGEDIR}/webstat.$LISP.core ]; then
LISP=sbcl
if [ ! -e ${LISPIMAGEDIR}/webstat.$LISP.core ]; then
LISP=clisp
if [ ! -e ${LISPIMAGEDIR}/webstat.$LISP.mem ]; then
echo "Error: no suitable Lisp images found in ${LISPIMAGEDIR}."
exit 1
fi
fi
fi
fi
## okay, try to run the process:
if [ "$LISP" == "lisp" ]; then
$LISP -core ${LISPIMAGEDIR}/webstat.$LISP.core -quiet -batch \
-eval "(progn (analyze-httpd-log-file \"$FILECFG\" \"$FILELOG\")(quit))"
elif [ "$LISP" == "sbcl" ]; then
$LISP --noinform --core ${LISPIMAGEDIR}/webstat.$LISP.core --disable-debugger \
--eval "(progn (analyze-httpd-log-file \"$FILECFG\" \"$FILELOG\")(quit))"
elif [ "$LISP" == "clisp" ]; then
$LISP -q -M ${LISPIMAGEDIR}/webstat.$LISP.mem \
-x "(progn (analyze-httpd-log-file \"$FILECFG\" \"$FILELOG\")(quit))"
else
echo "Error: $LISP not supported. Please read README."
exit 1
fi

Event Timeline