#!/bin/sh
URL="156.12.19.56:8001" #节点的ip:port
USER_NAME="weblogic" #weblogic控制台账户
PASS_WORD="Sxds121954#" #weblogic控制台密码
DOMAIN_NAME="sssl_domain" #域名字
SERVER_NAME="sssSvr5601" #节点名字
STATE_ALL=$(/usr/java/jdk1.6.0_45/bin/java -cp /weblogic/wlserver_10.3/server/lib/weblogic.jar weblogic.Admin -url $URL -username $USER_NAME -password $PASS_WORD get -pretty -mbean "$DOMAIN_NAME:Location=$SERVER_NAME,Name=$SERVER_NAME,Type=ServerRuntime")
CURRENT_TIME=date +%F" "%H:%M:%S
NUM1=echo "$STATE_ALL" | grep "State:HEALTH_OK"|wc -l
if [ $NUM1 -eq 2 ]; then
echo " $CURRENT_TIME $URL $DOMAIN_NAME $SERVER_NAME running status is OK" >>/weblogic/user_projects/domains/sssldomain/logs/AutoRestart5601date +%Y%m%d
.log
else
echo "$CURRENT_TIME $URL $DOMAIN_NAME $SERVER_NAME running status is not OK" >>/weblogic/user_projects/domains/sssldomain/logs/AutoRestart5601date +%Y%m%d
.log
/weblogic/user_projects/domains/sssl_domain/restartssl5601.sh
echo "$CURRENT_TIME $URL $DOMAIN_NAME $SERVER_NAME restart succese!" >>/weblogic/user_projects/domains/sssldomain/logs/AutoRestart5601date +%Y%m%d
.log
fi
转载于:https://blog.51cto.com/12250761/2307683