#! /bin/bash
#
# $Header: /cvsroot/lesstif/lesstif/scripts/ftp.hungry.com/nightly,v 1.51 2004/05/24 16:11:38 dannybackx Exp $
#
# set -x
#
# Do NOT install this script on terror!
# There's another script out there that updates one file (this one) from CVS,
# and then runs it. So updating this script in CVS is sufficient.
#
# Currently (as of June 7, 2001) this script is run hourly.
# Previously it was run daily.
#

NIGHTLY_DIR=/u/ltiff/nightly
ECHO=echo
# Get the script to be more silent:
#ECHO=true

CRON_ARG=$1

D=`date +%y%m%d`
FTPDIR=/var/ftp/pub/hungry/lesstif
SRC=/u/ltiff/lesstif/doc/www.lesstif.org
WEB_DIR=/usr/local/www/lesstif/docs
COPY=/u/ltiff/lesstif

export CRON_ARG
export ECHO
export	D
export	FTPDIR
export SRC
export WEB_DIR
export COPY

# Clean up old output:
rm -f $NIGHTLY_DIR/message

case $CRON_ARG in
	"cvs")
		sh cron_cvs.sh > $NIGHTLY_DIR/message 2>&1
	;;

	"website")
		sh cron_website.sh > $NIGHTLY_DIR/message 2>&1
	;;
esac

if [ -s $NIGHTLY_DIR/message ]; then
#	/usr/bin/Mail -s "Periodic lesstif script" lesstif-commits@lists.sourceforge.net < ${NIGHTLY_DIR}/message
#	/usr/bin/Mail -s "Periodic lesstif script" amai@users.sourceforge.net < ${NIGHTLY_DIR}/message
fi

#
# Don't remove the file, even when empty it is a timestamp
# that indicates when the script last ran.
#
#rm ${NIGHTLY_DIR}/message

exit 0
