[jboss-cvs] JBossAS SVN: r71027 - branches/JBPAPP_4_2_0_GA_CP/server/src/bin.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Mar 19 17:43:52 EDT 2008
Author: dbhole
Date: 2008-03-19 17:43:52 -0400 (Wed, 19 Mar 2008)
New Revision: 71027
Modified:
branches/JBPAPP_4_2_0_GA_CP/server/src/bin/jboss_init_redhat.sh
branches/JBPAPP_4_2_0_GA_CP/server/src/bin/jboss_init_suse.sh
Log:
Resolve JBPAPP-539, SOA-226: Use kill -SIGTERM to shutdown server, as default
installs have no user accounts (and therefore no access) to jmx.
Modified: branches/JBPAPP_4_2_0_GA_CP/server/src/bin/jboss_init_redhat.sh
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/server/src/bin/jboss_init_redhat.sh 2008-03-19 19:44:24 UTC (rev 71026)
+++ branches/JBPAPP_4_2_0_GA_CP/server/src/bin/jboss_init_redhat.sh 2008-03-19 21:43:52 UTC (rev 71027)
@@ -29,9 +29,6 @@
#if JBOSS_HOST specified, use -b to bind jboss services to that address
JBOSS_BIND_ADDR=${JBOSS_HOST:+"-b $JBOSS_HOST"}
-#define the classpath for the shutdown class
-JBOSSCP=${JBOSSCP:-"$JBOSS_HOME/bin/shutdown.jar:$JBOSS_HOME/client/jnet.jar"}
-
#define the script to use to start jboss
JBOSSSH=${JBOSSSH:-"$JBOSS_HOME/bin/run.sh -c $JBOSS_CONF $JBOSS_BIND_ADDR"}
@@ -59,7 +56,6 @@
JBOSS_CONSOLE=${JBOSS_CONSOLE:-"/dev/null"}
JBOSS_CMD_START="cd $JBOSS_HOME/bin; $JBOSSSH"
-JBOSS_CMD_STOP=${JBOSS_CMD_STOP:-"java -classpath $JBOSSCP org.jboss.Shutdown --shutdown"}
if [ -z "`echo $PATH | grep $JAVAPTH`" ]; then
export PATH=$PATH:$JAVAPTH
@@ -72,6 +68,68 @@
echo JBOSS_CMD_START = $JBOSS_CMD_START
+function procrunning() {
+ procid=0
+ JBOSSSCRIPT=$(echo $JBOSSSH | awk '{print $1}' | sed 's/\//\\\//g')
+ for procid in `/sbin/pidof -x "$JBOSSSCRIPT"`; do
+ ps -fp $procid | grep "${JBOSSSH% *}" > /dev/null && pid=$procid
+ done
+}
+
+
+stop() {
+ pid=0
+ procrunning
+ if [ $pid = '0' ]; then
+ echo -n -e "\nNo JBossas is currently running\n"
+ exit 1
+ fi
+
+ RETVAL=1
+
+ # If process is still running
+
+ # First, try to kill it nicely
+ for id in `ps --ppid $pid | awk '{print $1}' | grep -v "^PID$"`; do
+ if [ -z "$SUBIT" ]; then
+ kill -15 $id
+ else
+ $SUBIT "kill -15 $id"
+ fi
+ done
+
+ sleep=0
+ while [ $sleep -lt 120 -a $RETVAL -eq 1 ]; do
+ echo -n -e "\nwaiting for processes to stop";
+ sleep 10
+ sleep=`expr $sleep + 10`
+ pid=0
+ procrunning
+ if [ $pid == '0' ]; then
+ RETVAL=0
+ fi
+ done
+
+ # Still not dead... kill it
+
+ count=0
+ pid=0
+ procrunning
+
+ if [ $RETVAL != 0 ] ; then
+ for id in `ps axo pid,ppid|grep $pid|cut -d" " -f1,2`; do
+ if [ -z "$SUBIT" ]; then
+ kill -9 $id
+ else
+ $SUBIT "kill -9 $id"
+ fi
+ done
+ RETVAL=0
+ fi
+
+ exit 0
+}
+
case "$1" in
start)
cd $JBOSS_HOME/bin
@@ -82,11 +140,7 @@
fi
;;
stop)
- if [ -z "$SUBIT" ]; then
- $JBOSS_CMD_STOP
- else
- $SUBIT "$JBOSS_CMD_STOP"
- fi
+ stop
;;
restart)
$0 stop
Modified: branches/JBPAPP_4_2_0_GA_CP/server/src/bin/jboss_init_suse.sh
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/server/src/bin/jboss_init_suse.sh 2008-03-19 19:44:24 UTC (rev 71026)
+++ branches/JBPAPP_4_2_0_GA_CP/server/src/bin/jboss_init_suse.sh 2008-03-19 21:43:52 UTC (rev 71027)
@@ -29,9 +29,6 @@
#make java is on your path
JAVAPTH=${JAVAPTH:-"/usr/java/j2sdk1.4.1/bin"}
-#define the classpath for the shutdown class
-JBOSSCP=${JBOSSCP:-"$JBOSS_HOME/bin/shutdown.jar:$JBOSS_HOME/client/jnet.jar"}
-
#define the script to use to start jboss
JBOSSSH=${JBOSSSH:-"$JBOSS_HOME/bin/run.sh -c production"}
@@ -80,7 +77,6 @@
JBOSSUS=${JBOSSUS:-"jboss"}
CMD_START="cd $JBOSS_HOME/bin; $JBOSSSH"
-CMD_STOP="java -classpath $JBOSSCP org.jboss.Shutdown --shutdown"
if [ "$JBOSSUS" = "RUNASIS" ]; then
SUBIT=""
@@ -97,6 +93,69 @@
exit 1
fi
+function procrunning() {
+ procid=0
+ JBOSSSCRIPT=$(echo $JBOSSSH | awk '{print $1}' | sed 's/\//\\\//g')
+ for procid in `/sbin/pidof -x "$JBOSSSCRIPT"`; do
+ ps -fp $procid | grep "${JBOSSSH% *}" > /dev/null && pid=$procid
+ done
+}
+
+
+stop() {
+ pid=0
+ procrunning
+ if [ $pid = '0' ]; then
+ echo -n -e "\nNo JBossas is currently running\n"
+ exit 1
+ fi
+
+ RETVAL=1
+
+ # If process is still running
+
+ # First, try to kill it nicely
+ for id in `ps --ppid $pid | awk '{print $1}' | grep -v "^PID$"`; do
+ if [ -z "$SUBIT" ]; then
+ kill -15 $id
+ else
+ $SUBIT "kill -15 $id"
+ fi
+ done
+
+ sleep=0
+ while [ $sleep -lt 120 -a $RETVAL -eq 1 ]; do
+ echo -n -e "\nwaiting for processes to stop";
+ sleep 10
+ sleep=`expr $sleep + 10`
+ pid=0
+ procrunning
+ if [ $pid == '0' ]; then
+ RETVAL=0
+ fi
+ done
+
+ # Still not dead... kill it
+
+ count=0
+ pid=0
+ procrunning
+
+ if [ $RETVAL != 0 ] ; then
+ for id in `ps axo pid,ppid|grep $pid|cut -d" " -f1,2`; do
+ if [ -z "$SUBIT" ]; then
+ kill -9 $id
+ else
+ $SUBIT "kill -9 $id"
+ fi
+ done
+ RETVAL=0
+ fi
+
+ exit 0
+}
+
+
case "$1" in
start)
echo -n "Starting JBoss application server: "
@@ -112,11 +171,7 @@
;;
stop)
echo -n "Shutting down JBoss application server: "
- if [ -z "$SUBIT" ]; then
- $CMD_STOP
- else
- $SUBIT "$CMD_STOP"
- fi
+ stop
# Remember status and be verbose
rc_status -v
More information about the jboss-cvs-commits
mailing list