#!/bin/bash
echo "Configuring WebLogic server (version 6.0 or higher) for monitoring by eG ..."
echo " "
echo "Note: Only a server administrator has permissions to configure "
echo "      the eG monitoring capability for a WebLogic server."
echo " " 
echo "Enter the path of the applications directory of your WebLogic server: "
FLAG="y"
while [ "$FLAG" = "y" ]
do
	read rootDir
	if [ -n "$rootDir" ]
	then
		FLAG="n"
	else
		echo "Please enter a valid applications directory: "
	fi
done
echo "Are you the administrator of this server? y/n [y]: "
read accept
if test  "$accept" != "y" ; 
then
	echo "Please enter the user name of the WebLogic server's administator: "
	read user
	if test -z "$user" 
	then
		echo "Sorry! Invalid user name..."
		exit;
        fi
	echo "Next, you will need to enter the WebLogic server administrator's password ..."	
	su - $user -c "/opt/egurkha/bin/conf_wl $rootDir"
else
	/opt/egurkha/bin/conf_wl $rootDir
fi
