#!/bin/sh
# jboss-env.sh - starts a new shell with instance variables set

## set jboss base env
export JBOSS_DIR=/JBOSS/jboss-eap-5.1
export JBOSS_HOME=$JBOSS_DIR/jboss-as
export SERVER_HOME=$JBOSS_DIR/domains
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JBOSS_DIR/lib

export JBOSS_USER=jboss
export SERVER_NAME=portal02
export DOMAIN_IP=150.100.1.10

export JMX_CONSOLE_ID=`cat $SERVER_HOME/$SERVER_NAME/conf/props/jmx-console-users.properties | grep admin | awk -F '=' '{print $1}'`
export JMX_CONSOLE_PW=`cat $SERVER_HOME/$SERVER_NAME/conf/props/jmx-console-users.properties | grep admin | awk -F '=' '{print $2}'`
export JMX_CONSOLE_PORT=1099
export JMX_IP=$DOMAIN_IP:$JMX_CONSOLE_PORT

export JAVA_HOME=/usr/java/jdk1.6.0_30

export PATH=$JAVA_HOME/bin:$JBOSS_HOME/bin:$PATH

if [ "x$JAVA_OPTS" = "x" ]; then
   JAVA_OPTS="-server"
   JAVA_OPTS="$JAVA_OPTS -Dserver=$SERVER_NAME"
   JAVA_OPTS="$JAVA_OPTS -Djboss.server.base.dir=$SERVER_HOME"
   JAVA_OPTS="$JAVA_OPTS -Djboss.server.base.url=file://$SERVER_HOME"
   JAVA_OPTS="$JAVA_OPTS -Djboss.server.log.dir=/jboss_log/log"
   JAVA_OPTS="$JAVA_OPTS -Djboss.partition.name=portal-cluster01"
   JAVA_OPTS="$JAVA_OPTS -Djboss.partition.udpGroup=228.1.1.5"
   JAVA_OPTS="$JAVA_OPTS -Djboss.hapartition.mcast_port=57975"
   JAVA_OPTS="$JAVA_OPTS -Djboss.messaging.ServerPeerID=1"
   JAVA_OPTS="$JAVA_OPTS -Djboss.service.binding.set=ports-default"

#   JAVA_OPTS="$JAVA_OPTS -Djboss.modcluster.proxyList=$JBOSS_PROXY_LIST"

   JAVA_OPTS="$JAVA_OPTS -Xms2024m"
   JAVA_OPTS="$JAVA_OPTS -Xmx2024m"
   #JAVA_OPTS="$JAVA_OPTS -Xms6144m"
   #JAVA_OPTS="$JAVA_OPTS -Xmx6144m"
   JAVA_OPTS="$JAVA_OPTS -XX:PermSize=256m"
   JAVA_OPTS="$JAVA_OPTS -XX:MaxPermSize=256m"
   JAVA_OPTS="$JAVA_OPTS -Xss256k"

   JAVA_OPTS="$JAVA_OPTS -verbose:gc"
   JAVA_OPTS="$JAVA_OPTS -Xloggc:/jboss_log/gclog/gc.log"
   JAVA_OPTS="$JAVA_OPTS -XX:+PrintGCDetails"
   JAVA_OPTS="$JAVA_OPTS -XX:+PrintGCTimeStamps"
   JAVA_OPTS="$JAVA_OPTS -XX:+PrintHeapAtGC"
   JAVA_OPTS="$JAVA_OPTS -XX:+HeapDumpOnOutOfMemoryError"
   JAVA_OPTS="$JAVA_OPTS -XX:HeapDumpPath=/jboss_log/gclog/java_pid.hprof"
    
#   JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote"
#   JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.port=8286"
#   JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.ssl=false"
#   JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.authenticate=false"

   JAVA_OPTS="$JAVA_OPTS -Dorg.jboss.resolver.warning=true"
   JAVA_OPTS="$JAVA_OPTS -Djava.net.preferIPv4Stack=true"
   JAVA_OPTS="$JAVA_OPTS -Dsun.rmi.dgc.client.gcInterval=3600000"
   JAVA_OPTS="$JAVA_OPTS -Dsun.rmi.dgc.server.gcInterval=3600000"
   JAVA_OPTS="$JAVA_OPTS -Dsun.lang.ClassLoader.allowArraySyntax=true "
   JAVA_OPTS="$JAVA_OPTS -Dfile.encoding=EUC-KR"   
   JAVA_OPTS="$JAVA_OPTS -Djava.library.path=/JBOSS/jboss-eap-5.1/domains/portal02/lib"
fi

export JAVA_OPTS

echo "================================================"
echo " JBOSS_HOME=$JBOSS_HOME"
echo "SERVER_HOME=$SERVER_HOME"
echo "SERVER_NAME=$SERVER_NAME"
echo "================================================"


