[jboss-user] [Beginner's Corner] - Stop JBOSS time out

nefertiti do-not-reply at jboss.com
Thu Dec 10 04:56:12 EST 2009


when launching the script of JBOSS stop the script timeout and do not stop the jboss 
the  shutdown process and the jboss process keep runing so i have to do a kill -9 both of them 

here is the shutdown process :
java -classpath /sites/yyy/jboss/bin/shutdown.jar:/sites/yyy/jboss/client/jnet.jar org.jboss.Shut



here is the script i am using :
#!/bin/ksh

SITE_ID=yyy

TIMEOUT=300

LANG=EN
LC_ALL=fr_EN.ISO8859-15
TZ=MET
export LANG TZ LC_ALL

#-----------------------------------------------------------------
# Server properties
JBOSS_BIND_ADDRESS=111.111.11.11
JBOSS_SERVER_NAME=default
JBOSS_PARTITION_NAME=
JBOSS_CLUSTER_MULTICAST_IP=
JBOSS_CLUSTER_MULTICAST_PORT=
JBOSS_CLUSTER_EJB3ENTITY_MULTICAST_PORT=
JBOSS_CLUSTER_EJB3SFSB_MULTICAST_PORT=
JBOSS_CLUSTER_WEB_MULTICAST_PORT=
JBOSS_CLUSTER_JMXCONSOLE_MULTICAST_PORT=
PRODUCTION_MODE=n

#-----------------------------------------------------------------
# Home directories
export JAVA_HOME="/sites/yyy/jboss/sdk"
export JBOSS_HOME="/sites/yyy/jboss"
export JBOSS_SERVER_HOME="/sites/yyy/JBOSS_home/server"

#-----------------------------------------------------------------
# Virtual Machine and Memory arguments
JAVA_VM="-server"
MEM_ARGS="-Xms256m -Xmx512m -XX:MaxPermSize=128m"

#-----------------------------------------------------------------
# Grab some file descriptors.
ulimit -n 1024

#-----------------------------------------------------------------
# JBoss Classpath
#export JBOSS_CLASSPATH="/sites/yyy/data/apps/properties:${JBOSS_HOME}/bin/run.jar:${JAVA_HOME}/lib/tools.jar"
#export JBOSS_CLASSPATH="/sites/yyy/data/apps/properties/yyy:"/sites/yyy/data/apps/properties":${JBOSS_HOME}/bin/run.jar:${JAVA_HOME}/lib/tools.jar"
export JBOSS_CLASSPATH="/sites/yyy/data/apps/properties/yyy:/sites/yyy/data/apps/properties:${JBOSS_HOME}/bin/run.jar:${JAVA_HOME}/lib/tools.jar:${JBOSS_SERVER_HOME}/${JBOSS_
SERVER_NAME}/lib/ldap.jar"

#-----------------------------------------------------------------
# Java Options
export JBOSS_NATIVE_DIR="${JBOSS_HOME}/bin/native"
if [ -d "${JBOSS_NATIVE_DIR}" ]; then
    if [ "x${LD_LIBRARY_PATH}" = "x" ]; then
        LD_LIBRARY_PATH="${JBOSS_NATIVE_DIR}"
    else
        LD_LIBRARY_PATH="${JBOSS_NATIVE_DIR}:${LD_LIBRARY_PATH}"
    fi
    export LD_LIBRARY_PATH
    if [ "x${JAVA_OPTS}" = "x" ]; then
        JAVA_OPTS="-Djava.library.path=${JBOSS_NATIVE_DIR}"
    else
        JAVA_OPTS="${JAVA_OPTS} -Djava.library.path=${JBOSS_NATIVE_DIR}"
    fi
fi

#-----------------------------------------------------------------
# Setup JBoss specific properties
JAVA_OPTS="-Dprogram.name=run.sh ${JAVA_OPTS} ${JAVA_VM} ${MEM_ARGS}"
JBOSS_ENDORSED_DIRS="${JBOSS_HOME}/lib/endorsed"

#-----------------------------------------------------------------
# Start JBoss
echo "<`date`> Starting JBoss Server for site : ${SITE_ID}..." 

# Execute the JVM in the background
if [ "/sites/yyy" == "" ]; then
  chroot /sites/${SITE_ID} su - yyy -c \
      "\"${JAVA_HOME}/bin/java\" ${JAVA_OPTS} \
      -Djava.endorsed.dirs=${JBOSS_ENDORSED_DIRS} \
      -Djboss.server.base.dir=${JBOSS_SERVER_HOME} \
      -Djboss.server.base.url=file:${JBOSS_SERVER_HOME} \
      -Djboss.server.name=${JBOSS_SERVER_NAME} \
      -Djboss.partition.name=${JBOSS_PARTITION_NAME} \
      -Djboss.partition.udpGroup=${JBOSS_CLUSTER_MULTICAST_IP} \
      -Djboss.hapartition.mcast_port=${JBOSS_CLUSTER_MULTICAST_PORT} \
      -Djboss.ejb3entitypartition.mcast_port=${JBOSS_CLUSTER_EJB3ENTITY_MULTICAST_PORT} \
      -Djboss.ejb3sfsbpartition.mcast_port=${JBOSS_CLUSTER_EJB3SFSB_MULTICAST_PORT} \
      -Djboss.webpartition.mcast_port=${JBOSS_CLUSTER_WEB_MULTICAST_PORT} \
      -Dlog4jPropertiesFile=/data/apps/properties/xyz-log4j.properties \
      -DeqtoolsPropertiesFile=/data/apps/properties/xyz.properties \
      -classpath \"${JBOSS_CLASSPATH}\" \
      org.jboss.Main -b ${JBOSS_BIND_ADDRESS} $@" \
      >> /sites/${SITE_ID}/JBOSS_home/logs/jboss_console_`date +%Y%m%d`.log 2<&1 &
else
  su - uj2m -c \
      "\"${JAVA_HOME}/bin/java\" ${JAVA_OPTS} \
      -Djava.endorsed.dirs=${JBOSS_ENDORSED_DIRS} \
      -Djboss.server.base.dir=${JBOSS_SERVER_HOME} \
      -Djboss.server.base.url=file:${JBOSS_SERVER_HOME} \
      -Djboss.server.name=${JBOSS_SERVER_NAME} \
      -Djboss.partition.name=${JBOSS_PARTITION_NAME} \
      -Djboss.partition.udpGroup=${JBOSS_CLUSTER_MULTICAST_IP} \
      -Djboss.hapartition.mcast_port=${JBOSS_CLUSTER_MULTICAST_PORT} \
      -Djboss.ejb3entitypartition.mcast_port=${JBOSS_CLUSTER_EJB3ENTITY_MULTICAST_PORT} \
      -Djboss.ejb3sfsbpartition.mcast_port=${JBOSS_CLUSTER_EJB3SFSB_MULTICAST_PORT} \
      -Djboss.webpartition.mcast_port=${JBOSS_CLUSTER_WEB_MULTICAST_PORT} \
      -Dlog4jPropertiesFile=/sites/${SITE_ID}/data/apps/properties/xyz-log4j.properties \
      -DeqtoolsPropertiesFile=/sites/${SITE_ID}/data/apps/properties/xyz.properties \
      -classpath ${JBOSS_CLASSPATH} \
      org.jboss.Main -b ${JBOSS_BIND_ADDRESS} $@ \
      >> /sites/${SITE_ID}/JBOSS_home/logs/jboss_console_`date +%Y%m%d`.log 2<&1 &"
fi

JBOSS_PID=$!
# Trap common signals and relay them to the jboss process
trap "kill -HUP  ${JBOSS_PID}" HUP
trap "kill -TERM ${JBOSS_PID}" INT
trap "kill -QUIT ${JBOSS_PID}" QUIT
trap "kill -PIPE ${JBOSS_PID}" PIPE
trap "kill -TERM ${JBOSS_PID}" TERM

elapsed=0
while [ -z "`/bin/netstat -an | grep -v 127.0.0.1 | grep 111.111.11.11:8180.*LISTEN`" ]
do
  if [ $elapsed -ge ${TIMEOUT} ]; then
    echo "<`date`> Timeout expired, please check the logs"
    exit 1
  fi
  sleep 10
  elapsed=$((${elapsed}+10))
done

echo "<`date`> JBoss server started" 

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4269956#4269956

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4269956



More information about the jboss-user mailing list