###################################################################
# webdocs - automate HTML dbdoc data
# J. David Schronce - Tue Jan 22 12:10:54 CST 2008
###################################################################
# User Defined Variables
###################################################################
#
# MAXENV - Maximum number of environments to process on
# any machine. Included to prevent race conditions if
# all Lawson systems are removed from a machine and the
# script is invoked. Adjust as needed
#
# TARGETDIR - Assumes that $WEBDIR is defined in /etc/lawson.env
# Some location under WEBDIR/lawson where the dbdoc HTML
# files will be stored.
#
###################################################################
#set -xv
MAXENV=40
TARGETDIR=dbdoc
###################################################################
# End User Defined Variables
###################################################################
###################################################################
#
# Find an Active Environment to start in
#
###################################################################
ENVTSTCNT=0
while [ `which lstver | grep -c "no lstver"` -gt 0 ]
do
. $CV
ENVTSTCNT=`echo "$ENVTSTCNT +1" | bc`
if [ $ENVTSTCNT -gt $MAXENV ]; then
break
fi
done
#####################################################
#
# Check that we have a basic environment setup
#
#####################################################
ENVCNT=0
for LAENV in `grep "Set LAWENVNAME" /etc/lawson.env | awk '{print $3}'| sort -n`; do
PATH=$GENDIR/bin:$PATH
. cv $LAENV > /dev/null 2>&1
#####################################################
#
# Verify the Env exists
#
#####################################################
if [ "X$GENDIR" != "X" ] && [ -f $GENDIR/bin/dbdoc ]; then
# Does TARGETDIR exist?
if [ ! -d $WEBDIR/lawson/$TARGETDIR ]; then
mkdir $WEBDIR/lawson/$TARGETDIR
fi
cd $WEBDIR/lawson/$TARGETDIR
TMPINDEX="$WEBDIR/lawson/$TARGETDIR/tmpindex.htm"
# Create index file header
echo "" > $TMPINDEX
echo "
" >> $TMPINDEX # Get Productlines echo "
" >> $TMPINDEX echo "
$PLINE | |
  | System Codes " >> $TMPINDEX # Get SystemCodes for SC in `rngdbdump -cnt gen sysfile -f productline systemcode \ | grep $PLINE | cut -d"," -f 2 | sort -u \ | sed 's/"//g'` do echo "$PLINE : $SC" if [ ! -d $PLINE/$SC ]; then mkdir $PLINE/$SC fi echo "$SC \c" >> $TMPINDEX dbdoc -w $PLINE $SC dburf -w $PLINE $SC done echo " |
Copyright 2008 J. David Schronce" >> $TMPINDEX echo "" >> $TMPINDEX mv $TMPINDEX $WEBDIR/lawson/$TARGETDIR/index.htm fi done