#!/bin/sh
#
# sun_plan_preinstallp
#
# Copyright (c) 2001, PerfCap Corporation, Nashua NH
# All Rights Reserved.
#
# Preinstalation script for solaris install planner
#---------------------------------------------------------------

OS="`uname -s`"
OSVER="`uname -r`"

IMAGE=/usr/bin/ecap_monitor

# if softlink remove it

if [ -h ${IMAGE} ]
then
    if [ -x ${IMAGE} ]
    then
	 RUN_IMAGE="`/usr/bin/ecap_monitor  -status`"
	 if [ -n ${RUN_IMAGE} ]
	 then
	    echo "ecap_monitor running. Executing stop command..."
	    $IMAGE -stop
	    sleep 1
	  fi
    fi
    rm $IMAGE
fi

if [ -f ${IMAGE} ]
then
   RUN_IMAGE="`/usr/bin/ecap_monitor  -status`"
   if [ -n ${RUN_IMAGE} ]
   then
       echo "ecap_monitor running. Executing stop command..."
       $IMAGE -stop
       sleep 1
   fi
   echo " renaming  $IMAGE to  $IMAGE.`date +"%m%h%Y_%H%M"`"
   mv $IMAGE $IMAGE."`date +"%m%h%Y_%H%M"`"
fi
exit 0
