#
# Copyright 07/17/00 Sun Microsystems, Inc. All Rights Reserved.
#pragma ident	"@(#)preremove	1.3	00/07/17 SMI"
#
#	preremove script for package: SUNWmibii
#

# Exit codes for installation scripts 
e_ok=0      
e_fatal=1      # stop installation on this exit
e_warning=2    # Installation will go on. 
e_int=3        # Interrupted. Stop installation
e_reboot=10    # User must reboot after installation of all selected packages
e_rebootnow=20 # User must reboot right after installation of current package
               # To be added to one of the single-digit exit code above
# Trap interrupt
trap `exit $e_int` 15

AWK=/usr/bin/awk
ECHO=/usr/bin/echo
GREP=/usr/bin/grep
PS=/usr/bin/ps
WC=/usr/bin/wc
CRONTAB=/usr/bin/crontab

#
#	Stop running process(es)
#
if [ ${BASEDIR} = "/" ]
then
	if [ -f /etc/init.d/init.snmpdx ]
	then
		/etc/init.d/init.snmpdx stop
	fi

	#	In case it is not stopped

	wpid=`$PS -fe | $GREP mibiisa | $GREP -v grep | $AWK '{print $2}'`
	echo preremove: wpid is $wpid
	if [ -n "$wpid" ]	
	then
		kill -9 $wpid
	fi
fi

exit $e_ok 

