[jboss-cvs] JBossAS SVN: r109822 - trunk/server/src/bin.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Dec 10 07:04:15 EST 2010
Author: mladen.turk at jboss.com
Date: 2010-12-10 07:04:14 -0500 (Fri, 10 Dec 2010)
New Revision: 109822
Modified:
trunk/server/src/bin/jboss_init_solaris.sh
Log:
JBPAPP-4434 Support multiple instances.
Modified: trunk/server/src/bin/jboss_init_solaris.sh
===================================================================
--- trunk/server/src/bin/jboss_init_solaris.sh 2010-12-10 12:02:43 UTC (rev 109821)
+++ trunk/server/src/bin/jboss_init_solaris.sh 2010-12-10 12:04:14 UTC (rev 109822)
@@ -100,25 +100,31 @@
# sets global isJBossRunningPid with 1st process id if it is running
isJBossRunning()
{
- JBossHome=$2 JBossUserId=$1 instance=$3
- # pipeline reads 1st jboss pid if it is running for user, jboss home, and instance
- ps -u $JBossUserId -o pid -o args |
- grep "${JBossHome}" | grep -v "grep" > /tmp/$$.jboss
- read isJBossRunningPid junk < /tmp/$$.jboss
- rm -f /tmp/$$.jboss
+ JBossUserId=$1
+ JBossHome=$2
+ JBossInstance=$3
+ # Note that we don't check $instance, as it will be truncated in
+ # the -o args output below
+
+ # Find correct run.sh process (we might find more than 1 candidate)
+ isJBossRunningPid=`ps -u ${JBossUserId} -o pid -o args | \
+ awk '{if (index($0, "'${JBossHome}'") && $2 ~ /sh$/) print $1}'`
if [ "x${isJBossRunningPid}" = "x" ]; then
return 1
fi
- ps -u $JBossUserId -o pid -o args -o ppid |
- grep "Dprogram.name=run.sh" | grep -v "grep" | grep ${isJBossRunningPid} > /tmp/$$.jboss
- read isJBossRunningPid junk < /tmp/$$.jboss
- rm -f /tmp/$$.jboss
- if [ "x${isJBossRunningPid}" = "x" ]; then
- return 1
- else
- return 0
- fi
+ # Find java process with one of the above processes as parent
+ for JBossPid in ${isJBossRunningPid}; do
+ isPidRunning=`ps -u ${JBossUserId} -o pid -o args -o ppid | \
+ awk '{if ($2 ~ /java$/ && $NF ~ /^'${JBossPid}'$/) print $1}'`
+ if [ "x${isPidRunning}" != "x" ]; then
+ args=`pargs -l ${JBossPid}`
+ test "x${args}" = "x" && return 0
+ inst=`echo ${args} | grep "\-c ${JBossInstance}" 2>/dev/null`
+ test "x${inst}" = "x" && return 0
+ fi
+ done
+ return 1
}
#USAGE: isUserOK
Property changes on: trunk/server/src/bin/jboss_init_solaris.sh
___________________________________________________________________
Name: svn:executable
+ *
More information about the jboss-cvs-commits
mailing list