Для решения данной проблемы набросал скрипт
при запуске задаем :
- u) USER=${OPTARG};;
- m) MGR=${OPTARG};;
- p) PORT=${OPTARG};;
```
#!/bin/bash
while getopts u:m:p:h: option
do
case "${option}"
in
u) USER=${OPTARG};;
m) MGR=${OPTARG};;
p) PORT=${OPTARG};;
h) echo "-h this Help; -u USER; -m Name New manager; -p PORT";;
esac
done
crtmqm $MGR
strmqm $MGR
echo "DEFINE LISTENER($MGR.LISTENER) TRPTYPE(TCP) CONTROL(QMGR) PORT($PORT)" > /tmp/mq_command.sc
echo "START LISTENER($MGR.LISTENER)" >> /tmp/mq_command.sc
echo "DEFINE CHANNEL(CLIENT.SVRCONN) CHLTYPE(SVRCONN) TRPTYPE(TCP) MCAUSER('$USER')" >> /tmp/mq_command.sc
#echo "set chlauth(*) TYPE(BLOCKUSER) USERLIST(*MQADMIN) action(remove)" >> /tmp/mq_command.sc
#echo "alter qmgr connauth(NO)" >> /tmp/mq_command.sc
echo "alter qmgr chlauth(DISABLED)" >> /tmp/mq_command.sc
echo "DEFINE AUTHINFO(USE.PW2) AUTHTYPE(IDPWOS) FAILDLAY(10) CHCKLOCL(NONE) CHCKCLNT(NONE)" >> /tmp/mq_command.sc
echo "ALTER QMGR CONNAUTH(USE.PW2)" >> /tmp/mq_command.sc
echo "REFRESH SECURITY TYPE(CONNAUTH)" >> /tmp/mq_command.sc
runmqsc $MGR < /tmp/mq_command.sc
setmqaut -m $MGR -t qmgr -g "$USER" +connect +inq +alladm
setmqaut -m $MGR -n "**" -t q -g "$USER" +alladm +crt +browse
setmqaut -m $MGR -n "**" -t topic -g "$USER" +alladm +crt
setmqaut -m $MGR -n "**" -t channel -g "$USER" +alladm +crt
setmqaut -m $MGR -n "**" -t process -g "$USER" +alladm +crt
setmqaut -m $MGR -n "**" -t namelist -g "$USER" +alladm +crt
setmqaut -m $MGR -n "**" -t authinfo -g "$USER" +alladm +crt
setmqaut -m $MGR -n "**" -t clntconn -g "$USER" +alladm +crt
setmqaut -m $MGR -n "**" -t listener -g "$USER" +alladm +crt
setmqaut -m $MGR -n "**" -t service -g "$USER" +alladm +crt
setmqaut -m $MGR -n "**" -t comminfo -g "$USER" +alladm +crt
setmqaut -m $MGR -n SYSTEM.MQEXPLORER.REPLY.MODEL -t q -g "$USER" +dsp +inq +get
setmqaut -m $MGR -n SYSTEM.ADMIN.COMMAND.QUEUE -t q -g "$USER" +dsp +inq +put
endmqm -i $MGR
strmqm $MGR
echo "Done"
```