MQ Restart Script
This script dynamically start and stop the MQ.
Usage: ./mq_restart.sh <Action>
Here <Action > must be start or stop.
ACTION=$1
usage() {
echo -e " ******************************************"
echo -e " WARN: USAGE: $0 must be one of the following options: "
echo -e ""
echo -e " start - starts All the QMGRs exists in the server "
echo -e " stop - stops All the QMGRs exists in the server "
echo -e " ******************************************"
exit 1
}
STARTEDQMGR=""
STOPPEDQMGR=""
get_info(){
STARTEDQMGR=`dspmq|grep "Running" |awk -F"(" '{print $2}'|awk -F")" '{print $1}'`
STOPPEDQMGR=`dspmq|grep "Ended"|awk -F"(" '{print $2}'|awk -F")" '{print $1}'`
}
start_qmgr(){
get_info
if [ ! -z "${STOPPEDQMGR}" ]; then
for stopped in ${STOPPEDQMGR};
do
echo "starting ${stopped}....."
sudo -u mqm strmqm ${stopped}
done
else
echo "QMGR ${STARTEDQMGR} already started ......."
fi
}
stop_qmgr(){
get_info
if [ ! -z "${STARTEDQMGR}" ]; then
for started in ${STARTEDQMGR};
do
echo "stopping ${started}....."
sudo -u mqm endmqm ${started}
done
else
echo "QMGR ${STOPPEDQMGR} already started ......."
fi
}
############################
### MAIN TASKS START HERE###
############################
echo "***** ********************************************************************"
echo "***** WEBSPHERE MAINTAINANCE TASK: $1 for Environment ****************************"
echo "***** START TIME: "`date '+[ %d/%m/%Y ] %H:%M:%S'`
echo "***** ********************************************************************"
case "${ACTION}" in
start)
start_qmgr
;;
stop)
stop_qmgr
;;
*)
usage
;;
esac
echo "***** ********************************************************************"
echo "***** END TIME: "`date '+[ %d/%m/%Y ] %H:%M:%S'`
echo "***** ********************************************************************"
Usage: ./mq_restart.sh <Action>
Here <Action > must be start or stop.
mq_restart.sh
ACTION=$1
usage() {
echo -e " ******************************************"
echo -e " WARN: USAGE: $0 must be one of the following options: "
echo -e ""
echo -e " start - starts All the QMGRs exists in the server "
echo -e " stop - stops All the QMGRs exists in the server "
echo -e " ******************************************"
exit 1
}
STARTEDQMGR=""
STOPPEDQMGR=""
get_info(){
STARTEDQMGR=`dspmq|grep "Running" |awk -F"(" '{print $2}'|awk -F")" '{print $1}'`
STOPPEDQMGR=`dspmq|grep "Ended"|awk -F"(" '{print $2}'|awk -F")" '{print $1}'`
}
start_qmgr(){
get_info
if [ ! -z "${STOPPEDQMGR}" ]; then
for stopped in ${STOPPEDQMGR};
do
echo "starting ${stopped}....."
sudo -u mqm strmqm ${stopped}
done
else
echo "QMGR ${STARTEDQMGR} already started ......."
fi
}
stop_qmgr(){
get_info
if [ ! -z "${STARTEDQMGR}" ]; then
for started in ${STARTEDQMGR};
do
echo "stopping ${started}....."
sudo -u mqm endmqm ${started}
done
else
echo "QMGR ${STOPPEDQMGR} already started ......."
fi
}
############################
### MAIN TASKS START HERE###
############################
echo "***** ********************************************************************"
echo "***** WEBSPHERE MAINTAINANCE TASK: $1 for Environment ****************************"
echo "***** START TIME: "`date '+[ %d/%m/%Y ] %H:%M:%S'`
echo "***** ********************************************************************"
case "${ACTION}" in
start)
start_qmgr
;;
stop)
stop_qmgr
;;
*)
usage
;;
esac
echo "***** ********************************************************************"
echo "***** END TIME: "`date '+[ %d/%m/%Y ] %H:%M:%S'`
echo "***** ********************************************************************"
Comments
Post a Comment