Hello Team,
I have notes on how to ensure that JBOSS/Wildlfy is shutdown properly, but sometimes if a JBOSS/Wildfly process that is killed, it may be necessary to clean out the JMS queue.
Prior notes:
CA IAMSuite - Ensure JBOSS/Wildfly Shuts down Correctly
This process assumes that FILE REPLICATION configuration is used, and NOT SHARED configuration of the JMS queue.
Below is a shell script, that assumes JBOSS/Wildfly is currently running on a server.
I have this configure for two (2) instances of JBOSS/Wildfly. It may be modified for your environment.
Script copied to JIVE screens for better search results:
#!/bin/bash
##########################################################################
#
# If JBOSS is interrupted during startup, the JMS queue may impact later
# startup of JBOSS
#
#
##########################################################################
# Variables
BACKUPDATE=`date +%Y%m%d_%H%M%S_%N`
JBOSS_VER=jboss-eap-6.2
JBOSS_ROOT=/opt/CA/jboss
JBOSS01_IM_HOME="$JBOSS_ROOT"/im_01/"$JBOSS_VER"
JBOSS02_IM_HOME="$JBOSS_ROOT"/im_02/"$JBOSS_VER"
JBOSS01_IP_HOME="$JBOSS_ROOT"/ip_01/"$JBOSS_VER"
JBOSS01_IG_HOME="$JBOSS_ROOT"/ig_01/"$JBOSS_VER"
USER=jboss
GROUP=jboss
JBOSS01_PIDFILE=$JBOSS01_IM_HOME/standalone/log/jboss-im_01.pid
JBOSS02_PIDFILE=$JBOSS01_IM_HOME/standalone/log/jboss-im_02.pid
# Check running
ps -ef | grep -v grep | grep jboss
# init.d
/etc/init.d/jboss-im_01 stop > /dev/null 2>&1
/etc/init.d/jboss-im_02 stop > /dev/null 2>&1
# Kill jboss
kill -9 `ps -ef | grep jboss | grep -v grep | awk '{print $2}'` > /dev/null 2>&1
# Clean out JMS Hornetq temp and data folder
rm -rf $JBOSS01_IM_HOME/standalone/tmp/* > /dev/null 2>&1
ls -al $JBOSS01_IM_HOME/standalone/tmp/
rm -rf $JBOSS02_IM_HOME/standalone/tmp/* > /dev/null 2>&1
ls -al $JBOSS02_IM_HOME/standalone/tmp/
rm -rf $JBOSS01_IM_HOME/standalone/data/* > /dev/null 2>&1
ls -al $JBOSS01_IM_HOME/standalone/data/
rm -rf $JBOSS02_IM_HOME/standalone/data/* > /dev/null 2>&1
ls -al $JBOSS02_IM_HOME/standalone/data/
# Clean up pid files
rm -rf $JBOSS01_PIDFILE > /dev/null 2>&1
rm -rf $JBOSS02_PIDFILE > /dev/null 2>&1
# Completed
echo "Done"
After the above script has cleaned out the JMS files, startup up JBOSS/Wildfly and monitor the logs for any error messages due to prior JMS configurations/files.
Cheers,
Alan