#!/bin/sh -e

#=======================================================
#
# These four definitions specify the binary paths for
# nova and clyde and the writable document and log root
# for the web server.
# 
#=======================================================
#
#clyde_bin=/usr/local/servers/npac_http/tools/stats  NOT USED HERE!
nova_bin=/project/npac_srvtools/bin/stats
docroot=/usr/local/archives/public/html
#logroot=/project/C067
logroot=/project/www_npac_log
tmp=$logroot/tmp

statsdir=$docroot/stats


thisyear=`date +%y`
thismonth=`date +%h`
lastyear=`expr $thisyear - 1`

#
# THESE ARE REQUIRED BECAUSE NOVA DOES NOT HAVE A /usr/local/servers
# MOUNT POINT for /project/C420/s/
#
bindir=$nova_bin

wwwresult=$statsdir/wwwstats_28.html
wwwmonth=$statsdir/wwwstats.html
wwwyear=$statsdir/archive/$thisyear.wwwstats.html
#wwwyear=$statsdir/archive/96.wwwstats.html

gwstat="$bindir/gwstat"
combine="$bindir/combine"

#
# generate gwstat *.gifs
# 
# For gwstat to work the executables must be in the path!
# The easiest way to achieve this is to cd to the $bindir
#
echo '['`date`'] Starting: gwstat.sh'
cd $bindir
LD_LIBRARY_PATH=/usr/dt/lib:/usr/X11R6/lib:/usr/ucblib:/usr/openwin/lib
export LD_LIBRARY_PATH


#$gwstat -i $wwwmonth -S $statsdir/archive.conf -T selected
$combine +display -geometry +196+97 -size 100x100 \
-compose replace selected-chip.gif stats.gif stats1.gif

echo '['`date`'] Finished: gwstat.sh'
exit

