#!/bin/sh

#=======================================================
#
# These four definitions specify the binary paths for
# nova and clyde and the writable document and log root
# for the web server.
#
#=======================================================
#
clyde_bin=/srvtools/bin/stats
nova_bin=/project/npac_srvtools/bin/stats
docroot=/servers-admin/npac_http/html
#logroot=/e/p/C067
logroot=/e/s/log
tmp=/var/tmp

echo '['`date`'] run_month.sh: Starting'

html_archive=$docroot/stats/archive
thisyear=`date +%y`
#
#   Run script on clyde to build a statistics file wwwstat.html
#
\cp $html_archive/97.wwwstats.html $html_archive/97_old.wwwstats.html 

$clyde_bin/wwwstat_month.sh

if (test `date +%d` != "01") then
  echo  '['`date`'] run_month.sh: Not first of the month'
  \mv $html_archive/97.wwwstats.html $html_archive/97_new.wwwstats.html
  \mv $html_archive/97_old.wwwstats.html $html_archive/97.wwwstats.html 
fi

#
#   Remove current monthly gif for this year.  This will force another
#   one to be produced.
#
\rm -f $html_archive/$thisyear.monthly.gif
#
#   Run a script to update the monthly graphs for each year.
#
#rsh nova.npac.syr.edu $nova_bin/gwstat_month.sh
/usr/local/bin/ssh nova.npac.syr.edu $nova_bin/gwstat_month.sh

#
#   Finish
#
echo '['`date`'] run_month.sh: Finished'
exit
