#!/usr/bin/ksh
#set -x

PKGNAME="SUNWssmi"

if [ -z "`ps -edaf | grep [b]oks`" ]
then
   echo ""
   echo "$PKGNAME seems to be installed, but is not running."
   echo "This might be a problem if manual maintenence has been done."
   echo "Continue backing out patch anyway (yes/no)? \c"
   ans="dummy"
   read ans

   ans=`echo $ans | tr '[a-z]' '[A-Z]'`

   if [ "$ans" != "YES" -a "$ans" != "Y" ]
   then
      echo "Backing out patch was aborted by user."
      exit 1
   else
      echo "Continuing on users behalf."
      echo "You have to restart $PKGNAME manually."
   fi
else
   echo "$PKGNAME is up and running. Proceeding with backing out patch."
   echo "Stopping $PKGNAME (this is normal procedure)."  

   /opt/$PKGNAME/sbin/Boot -k && sleep 30
   touch /tmp/$PKGNAME_RESTART.$PPID
fi

echo "========================================================================="
echo
