#!/bin/sh 
# This script does pre remove tasks for
# the Seabreeze packages.
#
# Copyright (c) 1998 by Sun Microsystems, Inc.
# All rights reserved.
#
# @(#)preremove	1.4     06/07/99
#

############################################################################
# Set version subdirectory and configuration paths

VERSIONDIR="3_0"
SEAROOT="${BASEDIR}/SUNWseam"
SEABASEDIR="${SEAROOT}/${VERSIONDIR}"

############################################################################
# Stop any client processes that are running

echo "Stopping any management client applications, if they are running..."
PIDS=`/usr/bin/ps -deaf | grep "admin.client" | grep -v grep | cut -c1-24 | awk '{print $2}'`
PIDS="${PIDS} `/usr/bin/ps -deaf | grep "batchapp" | grep -v grep | cut -c1-24 | awk '{print $2}'`"
if [ "${PIDS}" = "" ]; then
	echo "No management client applications are running..."
fi
for PID in ${PIDS}
do
	echo "Stopping management client application process ${PID}"
	kill ${PID}
done

############################################################################
# Stop the daemon process if it is running

echo "Stopping the management server, if it is running..."
if [ -f /etc/init.d/admsvr${VERSDIR} ]
  then
	/etc/init.d/admsvr${VERSIONDIR} stop
fi

exit 0
