tpatil created the topic: Starting multiple instances of jboss from shell script
For starting the multiple instances of jboss I have created the following 2 scripts.
Please let me know if anybody has any other suggestions.
JBstartall.sh will call JBstart.sh
[code language=”css”]
{code}
##############
#JBstartall.sh
##############
#!/bin/sh
cluster=”node1:192.168.32.45,node2:192.168.32.46″
for clust in ${cluster//,/ };
do
HOST=`echo $clust |cut -f2 -d:`
NODE=`echo $clust |cut -f1 -d:`
echo “Starting jboss $NODE on $HOST …..”
./JBstart.sh $NODE $HOST
done
date
echo “JBstartall.sh complete”
exit 0
#####
# EOS
#####
{code}
and
{code}
#!/bin/sh
### ====================================================================== ###
## ##
## JBoss Startup Script ##
## ARG1 =====>Name of profile ##
## ARG2 =====>Hostname/IP address of node ##
### ====================================================================== ###
JBOSSDIR=/local/sys/jboss-eap-5.1/jboss-as
TARGETDIR=$JBOSSDIR/server/$1
BINDHOST=$2
JMXUSER=admin
JMXPASS=admin
echo “Starting jboss………..”
rm /tmp/jboss.$1.start > /dev/null
$JBOSSDIR/bin/run.sh -c $1 -b $BINDHOST > /tmp/jboss.$1.start 2>&1 &
pid=$!
started=false
for i in `seq 1 30` ; do
if ps -p $pid > /dev/null ; then : ; else
break
fi
sleep 2
result=”`$JBOSSDIR/bin/twiddle.sh -s $BINDHOST -u $JMXUSER -p $JMXPASS get “jboss.system:type=Server” Started –noprefix`”
if [ $? == 0 -a x”$result” == x”true” ] ; then
started=true
break
fi
done
if $started ; then
echo $pid >> $TARGETDIR/log/jboss.pid
echo “………Sucessfully Started”
exit 0
elif test i = 30 ; then
echo “……………Timed Out”
exit 1
else
echo “……………Failed to Start”
exit 1
fi
date
echo “JBstart.sh complete”
exit 0
#####
# EOS
#####
{code}
[/code]
I’m Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms.
I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.
Find Trusted Cardiac Hospitals
Compare heart hospitals by city and services — all in one place.
Explore Hospitals