#!/bin/sh
#
# @(#)preremove	1.7 8/2/93 Copyright (c) 1993 by Sun Microsystems, Inc.
#
# preremove script for lmgrd
licdir="/etc/opt/licenses"
lmgrdname="lmgrd.ste"
combined_lic="licenses_combined"
rest_of_path="SUNWste/license_tools"
ps -ef | grep ${lmgrdname} | grep -v grep > /dev/null 2>&1
if [ $? -eq 0 ]; then
	if [ ! -f $licdir/$combined_lic ]; then
		echo "No License File $licdir/$combined_lic - Cannot Kill License Manager Daemon"
	elif [ ! -x ${licdir}/lmdown  ]; then
		echo "Cannot execute ${licdir}/lmdown License File - Cannot Kill License Manager Daemon"
	else
		echo "Halting License Manager Daemon"
		${licdir}/lmdown -c $licdir/$combined_lic -q
	fi
fi
if [ -f ${licdir}/${combined_lic} ]
then
	echo "License File copied to ${licdir}/${combined_lic}.BAK"
	cp ${licdir}/${combined_lic} ${licdir}/${combined_lic}.BAK
fi
exit 0
