#!/bin/sh

# Name		: /public/scripts/Add2FESServ
# Purpose	: Adding lines to /usr/local/gwa/conf/fesserv.conf
#                 fesserv.conf is a list of services of Front-End-Server
#                 Its line structure is : 
#                 <service-name> http://<host-name>/<servlet-location>/<service-name>  
#		  This script usually called by ConfSetupGlb.pl
# By		: Yariv Sheizaf
# Date		: 25.12.2001


if [ "$USER" != "root" ]
then
	echo ""
	echo "$0 should be run with user root. Exit..."
	echo ""
	exit 1
fi


TMPDIR="/tmp/gc-conf"

if [ ! -d $TMPDIR ]
then
	echo ""
	echo $TMPDIR" is not exist. exit..."
	echo ""
	exit 1
fi


FESFILE=$TMPDIR/fesserv.conf

rm -f $FESFILE
touch $FESFILE

while true
do
	echo ""
	echo "Service name: (<enter> to exit) "
	read ANS
	if [ "$ANS" = "" ]
	then
		echo ""
		exit 0
	else	
		SERVNAME=$ANS
	fi
	
	echo ""
	echo "Host name: "
	read ANS
	HOSTN=$ANS

	
	echo ""
	echo "Servlet location: "
	read ANS
	SERVLOC=$ANS
	
	LINECONTENT=$SERVNAME" http://"$HOSTN"/"$SERVLOC"/"$SERVNAME

	echo $LINECONTENT >> $FESFILE
done	

exit 0