Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

Starting multiple instances of jboss from shell script

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]

Rajesh Kumar
Follow me
Latest posts by Rajesh Kumar (see all)
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x