#!/bin/sh
echo "Configuring Coldfusion for monitoring by eG ..."
echo " "
echo "Note: Only a server administrator has permissions to configure "
echo "      the eG monitoring capability for a Coldfusion server."
echo " " 
echo "Enter the document root of the web server with "
echo "which the Coldfusion server is associated: \c"
FLAG="y"
while [ "$FLAG" = "y" ]
do
	read rootDir
	if [ -n "$rootDir" ]
	then
		FLAG="n"
	else
		echo "Please enter a valid web server root directory: \c"
	fi
done
echo "Are you the administrator of this web server? y/n [y]: \c"
read accept
if test  "$accept" != "y" ; 
then
	echo "Please enter the user name of the web server's administator: \c"
	read user
	if test -z "$user" 
	then
		echo "Sorry! Invalid user name..."
		exit;
        fi
	echo "Next, you will need to enter the web server administrator's password ..."	
	su - $user -c "/opt/egurkha/bin/conf_cf $rootDir"
else
	/opt/egurkha/bin/conf_cf $rootDir
fi
