#!/bin/bash
rootDir=$1
if [ -d $rootDir ]
then
	echo "Configuring the Coldfusion server ..."
	if [ ! -d $rootDir/egurkha ]
	then
		mkdir $rootDir/egurkha
	fi
	cp /opt/egurkha/agent/config/index.html $rootDir/egurkha/
	cp /opt/egurkha/agent/config/cftest.cfm $rootDir/egurkha/
	echo "*********************************************************"
	echo "If there were any errors in the above steps, you may not "
	echo "have permissions to update files in the web server's "
	echo "document root. Please have the web server's administrator"
	echo "execute this script, namely /opt/egurkha/bin/setup_cf "
	echo "to configure a Coldfusion server for monitoring by "
	echo "the eG agent."
	echo "*********************************************************"
else
	echo "*********************************************************"
	echo " Document root - $rootDir does not exist!"
	echo " Failed to configure Coldfusion monitoring ..."
	echo " Please run this script again, providing the proper "
	echo " web server root directory."
	echo "*********************************************************"
fi
