#!/bin/bash
#----------------------------------------------------------------------------------
#Remove JVM parameter if WAS has been configured by ITCAMDC
#Syntax:
#For WebSphere ND servers:
#Command: ./ITCAM_remover.sh -h <Profile Home> -n <Server Name> -t SOAP
#Prerequisite: The dmgr and nodeagent is running.
#For WebSphere Base/Process/ESB/Portal servers:
#Command: ./ITCAM_remover.sh -h <Profile Home> -n <Server Name>
#Where "Profile Home" is the WebSphere profile home that has been configured by ITCAM DataCollector
# "Server Name" is the WebSphere server name that has been configured by ITCAM DataCollector
#----------------------------------------------------------------------------------
declare phost
declare srvname
declare conntype
while getopts "h:n:t:" opt; do
case $opt in
h) phost=$OPTARG;;
n) srvname=$OPTARG;;
t) conntype=$OPTARG;;
esac
done
if [ -z $phost ] || [ -z $srvname ]; then
echo "Syntax:"
echo "==================================================================================================== "
echo "For WebSphere ND servers:"
echo "Command :./ITCAM_remover.sh -h <Profile Home> -n <Server Name> -t SOAP"
echo "Prerequisite :The dmgr and nodeagent is running."
echo ""
echo "For WebSphere Base/Process/ESB/Portal servers:"
echo "Command :./ITCAM_remover.sh -h <Profile Home> -n <Server Name>"
echo ""
echo "Where <Profile Home> is the WebSphere profile home that has been configured by ITCAM DataCollector"
echo " <Server Name> is the WebSphere server name that has been configured by ITCAM DataCollector"
echo "==================================================================================================== "
exit 1
fi
if [ -z $conntype ]; then
conntype=NONE
fi
read -p "This tool will remove ITCAM JVM paramters form this WAS instance?Are you sure?(Y/N)?" rmOrNot
if [ $rmOrNot != "Y" ] && [ $rmOrNot != 'y' ]; then
exit 0
fi
source $phost/bin/setupCmdLine.sh
#echo USER_INSTALL_ROOT=$USER_INSTALL_ROOT
#echo WAS_USER_SCRIPT=$WAS_USER_SCRIPT
#echo WAS_HOME=$WAS_HOME
#echo WAS_CELL=$WAS_CELL
#echo WAS_NODE=$WAS_NODE
if [ -z $WAS_CELL ] || [ -z $WAS_NODE ]; then
echo "Error:source command failed!"
exit 1
fi
$phost/bin/wsadmin.sh -conntype $conntype -f ./removejvm.jacl $WAS_CELL $WAS_NODE $srvname
status=$?
if [ $status = 0 ]; then
echo "The ITCAM JVM parameters have been removed sucessfully!"
else
echo "Remove ITCAM JVM parameters failed!"
fi