JBOSS : WARs deployment shell script

Below is simple example of deploying the list of WARs from a props file and deploy into JBOSS.
---------Script 1 invokes script 2 and creates a log file---------
#!/bin/sh
datestr=$(date +%Y%m%d_%H%M%S)
./connectToCLLI.sh > AsocDeploymentLog_$datestr
-----------------------------------------------------------------------

----------SCRIPT 2 , reads props file and get the WAR file and Group information-------
#!/bin/ksh
echo "Setting JBOSS Env"
export JBOSS_HOME=/export/opt/jboss/jboss-eap-6.3
export JAVA_HOME=/opt/app/java/jdk/jdk160
export PATH=$PATH:$JBOSS_HOME/bin:$JAVA_HOME/bin
export JB_CLI=$JBOSS_HOME/bin/jboss-cli.sh
DEPLOYMENT_HOST=`nslookup \`hostname\` |grep Name | awk '/:/{print $2}'`
export HOME_DIR=/pbcf/ctfr1603/

echo "JBOSS Environment is ready and connecting to CLLI"
allDeployed=0
for LINE in `cat deploymentDescABC.props | grep -v "#"`
{
 VAL1=`echo $LINE |cut -d '|' -f1 `
 GROUPS=`echo $LINE |cut -d '|' -f2 `
 export WAR_FILE=$HOME_DIR$VAL1
 echo "Deploying $WAR_FILE now"
 #export COMMANDS="connect,deploy $WAR_FILE --force,quit"
 export COMMANDS="connect,deploy $WAR_FILE --server-groups=$GROUPS,quit"
 echo "COMMANDS is $COMMANDS"
 if $JB_CLI -c --controller=$DEPLOYMENT_HOST:9999  --commands="$COMMANDS"
  then
       echo "Deployment successful for $WAR_FILE !!"
 else
       echo "Deployment failed for $WAR_FILE "
       allDeployed=1
       break
 fi
}
if [ $allDeployed = "0" ]
  then
       echo "Overall deployment of all WARs is successful"
else
       echo "Overall deployment FAILED !!"
fi 
 ---------------------------------------------------------------------------------------------------------

----------Sample Props file -------------
 # list of WARs for ASOC Module
/abc/def/MyTestwar|G2
/abc/def/YourTestwar|G2
All WARs done#
----------------------------------------------

Sample Deploy and undeploy commands : 
 [jboss@hex0015 bin]$ ./jboss-cli.sh --controller=hex0015.abc.com:9999
You are disconnected at the moment. Type 'connect' to connect to the server or 'help' for the list of supported commands.
----------------------------
[disconnected /] connect
[domain@hex0015.abc.com:9999 /] deploy /ssd/etc/jboss_config/atp/csac/PressQuery.war --all-server-groups
[domain@hex0015.abc.com:9999 /]  undeploy PressQuery.war --all-relevant-server-groups
 


0 comments to "JBOSS : WARs deployment shell script"

Post a Comment

Whoever writes Inappropriate/Vulgar comments to context, generally want to be anonymous …So I hope U r not the one like that?
For lazy logs, u can at least use Name/URL option which doesn’t even require any sign-in, The good thing is that it can accept your lovely nick name also and the URL is not mandatory too.
Thanks for your patience
~Krishna(I love "Transparency")

Popular Posts

Enter your email address:

Buffs ...

Tags


Powered by WidgetsForFree

Archives