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

nefertiti do-not-reply at jboss.com
Thu Dec 10 05:02:49 EST 2009


sorry i wanted to put the stop script here it is 


#!/bin/ksh

SITE_ID=XY_DD

TIMEOUT=300

LANG=en
LC_ALL=en_EN.ISO8859-15
TZ=MET
export LANG TZ LC_ALL

#-----------------------------------------------------------------
# Server properties
JBOSS_BIND_ADDRESS=11.11.11.11
JBOSS_SERVER_NAME=default
JBOSS_JNDI_PORT=1899
PRODUCTION_MODE=y

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

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

#-----------------------------------------------------------------
# JBoss Classpath
export JBOSS_CLASSPATH="${JBOSS_HOME}/bin/shutdown.jar:${JBOSS_HOME}/client/jnet.jar"

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

# Execute the JVM in the background
if [ "/sites/XY_DD" == "" ]; then
      chroot /sites/${SITE_ID} su - uDD -c \
          "\"${JAVA_HOME}/bin/java\" \
          -classpath \"${JBOSS_CLASSPATH}\" \
          org.jboss.Shutdown -s \"jnp://${JBOSS_BIND_ADDRESS}:${JBOSS_JNDI_PORT}\"" \
          >> /sites/${SITE_ID}/JBOSS_home/logs/jboss_console_shutdown_`date +%Y%m%d`.log 2<&1 &
else
      su - uDD -c \
          "\"${JAVA_HOME}/bin/java\" \
          -classpath \"${JBOSS_CLASSPATH}\" \
          org.jboss.Shutdown -s \"jnp://${JBOSS_BIND_ADDRESS}:${JBOSS_JNDI_PORT}\"" \
          >> /sites/${SITE_ID}/JBOSS_home/logs/jboss_console_shutdown_`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 11.11.11.11.*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 stopped" 
exit 0

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

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



More information about the jboss-user mailing list