#!/sbin/sh
#
# Copyright (c) 2003 by Sun Microsystems, Inc.
# All rights reserved.
#
#ident  "@(#)mpsadm  "

# Test if we are in a cluster and silently exit if so
/usr/sbin/clinfo > /dev/null 2>&1
[ $? -eq 0 ] && exit 0

DIR=""
BASEDIR=`pkginfo -r SUNWasvu | head -1`
MPS_SR="/var/mps/serverroot"
[ -r "$BASEDIR/etc/mps/admin/v5.2/shared/config/serverroot.conf" ] || exit 0
MPS_SR=`cat $BASEDIR/etc/mps/admin/v5.2/shared/config/serverroot.conf`

if [ ! -f ${MPS_SR}/admin-serv/config/adm.conf ]; then
	# admin server is not configured, can not be started...
	exit 0
fi

case "$1" in
start)
        $BASEDIR/usr/sbin/mpsadmserver start
        if [ $? -ne 0 ]; then
          echo "$0: unable to start the admin server"
          exit 1
        fi
        ;;

stop)
        $BASEDIR/usr/sbin/mpsadmserver stop
        if [ $? -ne 0 ]; then
          echo "$0: unable to stop the admin server"
          exit 1
        fi
        ;;

*)
        echo "Usage: $0 { start | stop }"
        exit 1
        ;;
esac
exit 0

