有时,linux系统需要做HA或者类似的功能,需要配置weblogic脚本来启动,停止,查看状态,可以如下方式写

命令形式:Weblogic server start|stop|restart|status

### BEGIN WLS Configration
DOMAIN_NAME=base_domain
SERVER_NAME=AServer 
ADMIN_URL="t3://ip:7001"
DOMAIN_PATH=/Oracle/Middleware/user_projects/domains/${DOMAIN_NAME}
#使用这个命令得到weblogic对应服务进程的进程号
WLS_PID=`ps -ef|grep java|grep =${SERVER_NAME}|awk '{print $2}'`
#USER_NAME=`logname`
USER_NAME=`whoami`
## WLS_MEMORY
USER_MEM_ARGS="-Xms2048m -Xmx3096m -XX:PermSize=256m -XX:MaxPermSize=512m"
export USER_MEM_ARGS
### END WLS Configration

######### Weblogic server start|stop|restart|status
#用于等待进程启停
wait_for_pid () 
{
  try=0
    case "$1" in
      'created')
        while test $try -lt 7 ; do
        printf .
        try=`expr $try + 1`
        sleep 1
        done            
        WLS_PID=`ps -ef|grep java|grep ${SERVER_NAME}|awk '{print $2}'`            
        if [ "$WLS_PID" != "" ] ; then
          try=''                         
        fi
      ;;
      'removed')
        while test $try -lt 35 ; do  
        WLS_PID=`ps -ef|grep java|grep ${SERVER_NAME}|awk '{print $2}'`
        if [ "${WLS_PID}" = "" ] ; then
          try=''
        break
        fi
        printf .
        try=`expr $try + 1`
        sleep 1
        done
      ;;
    esac
}
#判断操作用户名,不能是root需要使用weblogic用户
if [ "$USER_NAME" = "root" ] ; then
  echo "USER_NAME is $USER_NAME! Plz use weblogic!"
  exit 1
fi
#domain不能为空
if [ "$DOMAIN_NAME" = "" ] ; then
  echo "DOMAIN_NAME is not set! Plz set DOMAIN_NAME!"
  exit 1
fi
#service不能为空
if [ "$SERVER_NAME" = "" ] ; then
  echo "SERVER_NAME is not set! Plz set SERVER_NAME!"
  exit 1
fi
#url不能为空
if [ "$ADMIN_URL" = "" ] ; then
  echo "ADMIN_URL is not set! Using default ADMIN_URL!"
fi
#如果是查看状态命令       
if [ "$1" = "status" ]
  then        
  if [ "${WLS_PID}" = "" ] ; then
   echo "No pid - $SERVER_NAME is not running !"
    exit 1
 else 
  echo "$SERVER_NAME is running !"
  exit 0
 fi
fi
printf "Terminating $SERVER_NAME "
  if [ "${WLS_PID}" = "" ] ; then
    echo "No pid - $SERVER_NAME is not running !"
  else          
    kill -9 $WLS_PID
  wait_for_pid removed 
  if [ -n "$try" ] ; then
  echo " failed "
  exit 1         
  fi
    echo " done ! "
    exit 0
 fi
#如果是停止命令,这里不使用这个        
if [ "$1" = "stop" ]
then        
echo ""
else
#启动命令
printf "Starting $SERVER_NAME "
  if echo $SERVER_NAME|grep -q dmin ; then        
    nohup sh $DOMAIN_PATH/bin/startWebLogic.sh &
  else        
    nohup sh $DOMAIN_PATH/bin/startManagedWebLogic.sh $SERVER_NAME $ADMIN_URL &
  fi        
  wait_for_pid created 
  if [ -n "$try" ] ; then
    echo " failed "
    exit 1
  else
    echo " done ! "
    exit 0
  fi   
fi 
echo "To check the log, you may excute:"
echo "tail -100f "

以上所述是小编给大家介绍的linux bash脚本监控启动停止weblogic服务的脚本写法,希望对大家有所帮助,如果大家有任何疑问欢迎给我留言,小编会及时回复大家的!

广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!

RTX 5090要首发 性能要翻倍!三星展示GDDR7显存

三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。

首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。

据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。