#!/bin/bash # For different version update keyword correctly go get jboss process like jboss-eap-7.x procCount=`ps -ef |grep "jboss-eap-6.4/" |grep -v grep |wc -l` if [ $procCount -gt 0 ] ; then ps -ef |grep "jboss-eap-6.4/" |grep -v grep | awk '{ print $2 }' |xargs kill -9 2>&1 if [ $? -eq 0 ] ; then echo -e " JBOSS Master Stopped successfully" else echo -e " Unable to stop ..please check" fi else echo "Jboss is not running .." fi