#!/bin/ksh
# 
# Copyright (c) 2002 by Sun Microsystems, Inc.
# All rights reserved.                           
#
# Start an MTP Administration Agent.
#
# Note that only one such agent is required to provide remote administrative
# access to many MTP regions.
#
# This script assumes that it is located in the bin directory of the
# installed Mainframe Administration Agent. If it is moved, then the
# MAA_INSTALL_DIR environment variable can be set to override the
# calculations here.
#

#
# Determine where the installation of the agent is.
#
if [ -z "$MAA_INSTALL_DIR" ]; then
    D=$(dirname $0)
    B=$(basename $0)
    abspath="`cd \"$D\" 2>/dev/null && pwd || echo \"$D\"`/$B"
    MAA_INSTALL_DIR=`dirname $(dirname $abspath)`
else
    if [ -f "${MAA_INSTALL_DIR}/lib/sunmaa.jar" ]; then
        echo "Using agent installation directory '"$MAA_INSTALL_DIR"'"
    else
        echo "Could not find '"${MAA_INSTALL_DIR}"/lib/sunmaa.jar'"
        exit 1
    fi
fi

cd ${MAA_INSTALL_DIR}

#
# The following line starts up the JMX/JDMK agent with an 
# RMI connector listening on the default port (9980). This port
# number can be changed by use of the  '-rmi <portnum>' flag.
#
java -server -jar lib/sunmaa.jar -mlet etc/mlet.txt
