#!/bin/sh
datetime=`date +%Y%m%d%H%M%S`
user=`whoami`
logDir=/app/logs/sg_qyjx
domainBase=/app/weblogic/domains
domainName=qyjx_cluster
adminip=192.168.10.129
adminPort=7001
serverName=AdminServer
ManagedserverName=Server1
if [ "$user" = "root" ]; then
echo "root 不能执行此操作"
exit 0
else
pid=`ps -ef|grep "Name=$serverName"|grep -v grep|awk '{print $2}'`
if [ $pid ] ; then
echo "service still active, killing..."
kill -9 $pid
else
echo "sevice stopped."
fi
fi
DOMAIN_HOME=$domainBase/$domainName
cd $DOMAIN_HOME
mkdir -pv security
cd $DOMAIN_HOME/security
cat <<EOF>boot.properties
username=weblogic
password=weblogic123
EOF
sed -i '453i export JAVA_OPTIONS="${JAVA_OPTIONS} -Dweblogic.system.BootIdentityFile=${DOMAIN_HOME}/security/boot.properties"' $DOMAIN_HOME/bin/setDomainEnv.sh
function start_admin(){
echo "["`date "+%Y/%m/%d %H:%M:%S"`"] Start to start WebLogic 10.3.6.0 adminserver on nopasswd mode."
cd $DOMAIN_HOME/bin
export USER_MEM_ARGS="-Xms1024m -Xmx1024m -XX:MaxPermSize=512m -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=./heapdump_${serverName}_${datetime}.hprof -Xloggc:gc_${serverName}_${datetime}.log"
nohup ./startWebLogic.sh > $logDir/$serverName.log &
}
function start_server(){
echo "["`date "+%Y/%m/%d %H:%M:%S"`"] Start to start WebLogic 10.3.6.0 server1 on nopasswd mode."
cd $DOMAIN_HOME/bin
export USER_MEM_ARGS="-Xms2048m -Xmx2048m -XX:MaxPermSize=512m -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=./heapdump_${ManagedserverName}_${datetime}.hprof -Xloggc:gc_${ManagedserverName}_${datetime}.log"
nohup ./startManagedWebLogic.sh $ManagedserverName http://$adminip:$adminPort > $logDir/$ManagedserverName_${datetime}.log &
}
start_admin
start_server
##########################################################################################
JVM 配置:USER_MEM_ARGS="-Xms2048m -Xmx2048m -XX:MaxPermSize=512m
Java 虚拟机具有一个堆(Heap),堆是运行时数据区域,所有类实例和数组的内存均从此处分配。堆是在 Java 虚拟机启动时创建的,在JVM中堆之外的内存称为非堆内存(Non-heap memory)。
简单的说就是:堆是java代码可及的内存,开发人员写的东西都是堆分配的内存(底层实现除外)。而非堆内存则是JVM自己用的,比如JVM内部处理或优化,垃圾处理,常数池等。