#!/bin/bash set -e yell() { printf "\033[1;6;37;41m$0: $*\033[0m\n" >&2; } die() { yell "$*" exit 111 } try() { "$@" || die "FAIL: $*"; } cmd() { local info="${2:-$1}" echo -e "\n💡 $info" eval "$1" } TARGET=$VAR2 BROKER=$VAR3 if [[ $TARGET == "DRC" ]]; then if [[ $(mqsilist | grep "$BROKER" | grep "stopped") ]]; then if [[ $(dspmq | grep ${BROKER}.QM | grep "Ended") ]]; then try cmd "strmqm ${BROKER}.QM > output.log 2>&1 &" \ "Start QM ${BROKER}.QM" sleep 30 fi; try cmd "mqsistart $BROKER > output.log 2>&1 &" \ "Start Integration Node $BROKER" sleep $((2 * 60)) fi; fi; while read -r line; do type=$(echo "$line" | cut -d';' -f 1) if [[ "$type" == "SCRIPT" ]]; then SCRIPT=$(echo "$line" | cut -d';' -f 2) try cmd "${SCRIPT}" fi; if [[ "$type" == "DIS" ]]; then if [[ $(mqsilist | grep "$BROKER" | grep "stopped") ]]; then if [[ $(dspmq | grep ${BROKER}.QM | grep "Ended") ]]; then try cmd "strmqm ${BROKER}.QM > output.log 2>&1 &" \ "Start QM ${BROKER}.QM" sleep 30 fi; try cmd "mqsistart $BROKER > output.log 2>&1 &" \ "Start Integration Node $BROKER" sleep $((2 * 60)) fi; IS=$(echo "$line" | cut -d';' -f 3) if [[ $(mqsilist $BROKER | grep "$IS") ]]; then try cmd "mqsideleteexecutiongroup ${BROKER} -e ${IS}" fi; fi; if [[ "$type" == "DBR" ]]; then IS=$(echo "$line" | cut -d';' -f 3) BAR=$(echo "$line" | cut -d';' -f 4) try cmd "mqsideploy ${BROKER} -e ${IS} -d ${BAR}" fi; done < <( cat $VAR4/ExtraScript.sh) # echo $TARGET if [[ $TARGET == "DRC" ]]; then try cmd "mqsistop $BROKER > output.log 2>&1 &" \ "Stop Integration Node $BROKER" sleep $((2 * 60)) try cmd "endmqm -i ${BROKER}.QM" \ "Stop QM ${BROKER}.QM" fi;