一个shell的例子

#!/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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值