#!/bin/sh
#
# Copyright (c) 2002 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#

PID_FILE=%%%SUBDIR%%%/logs/pid

if test -f $PID_FILE ; then
	kill -TERM `cat $PID_FILE`
	if test $? -ne 0 ; then
		exit 1
	fi
else
	echo server not running
	exit 1
fi

loop_counter=1
max_count=30
while test $loop_counter -le $max_count; do
	loop_counter=`expr $loop_counter + 1`
	if test -f $PID_FILE ; then
		sleep 2
	else
        echo server has been shutdown
		exit 0
	fi
done
echo server not responding to exit command
echo killing process group
kill -9 -`cat $PID_FILE`
rm $PID_FILE

exit 1

