ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum IndexWebSphere Message Broker (ACE) Supportmqsi-commands behaves differently when used in a script

Post new topicReply to topic
mqsi-commands behaves differently when used in a script View previous topic :: View next topic
Author Message
JanB_193
PostPosted: Wed Nov 12, 2014 2:42 am Post subject: mqsi-commands behaves differently when used in a script Reply with quote

Novice

Joined: 22 Aug 2014
Posts: 15

Hi all

when issuing a sequences of "mqsi...." commands in a console everything works fine:

C:\Program Files\IBM\MQSI\9.0.0.2>mqsistop 1LGCIIBPBRK
BIP8071I: Befehl wurde erfolgreich ausgeführt.

C:\Program Files\IBM\MQSI\9.0.0.2>mqsibackupbroker 1LGCIIBPBRK -d "D:\Backups\II
B\1LGCIIBPBRK" -v "D:\Backups\IIB\1LGCIIBPBRK\Trace.log"
BIP1252I: Sicherungsdatei 'D:\Backups\IIB\1LGCIIBPBRK\1LGCIIBPBRK_141112_111626.
zip' für Broker '1LGCIIBPBRK' wird erstellt.
BIP8071I: Befehl wurde erfolgreich ausgeführt.

C:\Program Files\IBM\MQSI\9.0.0.2>mqsistart 1LGCIIBPBRK
BIP8096I: Der Befehl wurde erfolgreich eingeleitet. Lesen Sie das Systemprotokol
l, um zu überprüfen, ob die Komponente fehlerfrei gestartet wurde und ordnungsge
mäß ausgeführt wird.

C:\Program Files\IBM\MQSI\9.0.0.2>


However if I issue the same sequence of commands in a cmd file the processing stops after the first "mqsi" command and the window is closed before the next "mqsi..." command can be executed.
The mqsistop command was sucessfully executed but the control never came back to the script.
The re-directed output of the script looks like this:

*
* Backing up Broker 1LGCIIBPBRK
*
*
* Setting the execution environment for 1LGCIIBPBRK
*
mqsiprofile extended for Healthcare Pack Web-based Monitoring

MQSI 9.0.0.2
C:\Program Files\IBM\MQSI\9.0.0.2

*
* Stop Broker 1LGCIIBPBRK
*

And the relevant commands in the script looks like this:

:: Normal processing starts here
ECHO *
ECHO * Backing up Broker %BRK%
ECHO *
ECHO *
ECHO * Setting the execution environment for %BRK%
ECHO *
CALL "C:\Program Files\IBM\MQSI\9.0.0.2\bin\mqsiprofile.cmd"
ECHO *
ECHO * Stop Broker %BRK%
ECHO *
mqsistop %BRK%
ECHO *
ECHO Backup Broker %BRK%
ECHO *
mqsibackupbroker %BRK% -d "D:\Backups\IIB\%BRK%" -v "D:\Backups\IIB\%BRK%\Trace.log"
ECHO *
ECHO * Start Broker %BRK%
ECHO *
mqsistart %BRK%

:End
pause >nul


If I run the script a second time he will (correctly) complain, that he can't stop the broker and then execute the next "mqsibackupbroker"-command and make a successfull backup. The following "mqsistart" command is not executed:

*
* Backing up Broker 1LGCIIBPBRK
*
*
* Setting the execution environment for 1LGCIIBPBRK
*
mqsiprofile extended for Healthcare Pack Web-based Monitoring

MQSI 9.0.0.2
C:\Program Files\IBM\MQSI\9.0.0.2

*
* Stop Broker 1LGCIIBPBRK
*
BIP8019E: Broker '1LGCIIBPBRK' gestoppt.
Dieser Broker ist gestoppt. Der Befehl, den Sie ausgegeben haben, kann nicht verarbeitet werden, solange der Broker gestoppt ist.
Es wurde ein vorheriger Befehl zum Stoppen dieses Brokers ausgegeben oder der Broker war noch gar nicht gestartet.
Dieser Broker kann gestartet, geändert oder gelöscht werden.
*
* Backup Broker 1LGCIIBPBRK
*
BIP1252I: Sicherungsdatei 'D:\Backups\IIB\1LGCIIBPBRK\1LGCIIBPBRK_141112_114410.zip' fr Broker '1LGCIIBPBRK' wird erstellt.
BIP8071I: Befehl wurde erfolgreich ausgefhrt.



Any Ideas what I'm doing wrong?

cheers Jan

Back to top
View user's profile Send private message
smdavies99
PostPosted: Wed Nov 12, 2014 3:18 am Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

There are two points to consider here (there may be more)

1) Don't try to apply the profile twice. Add some logic to test for the existence of say MQSI_WORKPATH. Then only call the profile command script if it does not exist OR contain the right data.

2) Consider wrapping key mqsicommands with a 'setlocal' & 'endlocal' wrapper.
There are issues with things like mqsicreateexecutiongroup when run from a shell. I get around this by creating a separate .bat file with the mqsicreateexectiongroup command in it and then calling that. The special .bat file has three lines. The .bat file is created by the script itself using 'echo' commands piped to the new file.
Code:

setlocal
mqsicreatexecutiongroup
endlocal


These may not be needed but I've had less problems since I adopted this approach.

This should also stop the first problem you reported from happening (with the mqsibackupbroker)
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
JanB_193
PostPosted: Wed Nov 12, 2014 5:34 am Post subject: Reply with quote

Novice

Joined: 22 Aug 2014
Posts: 15

Hi,

thanks for the advice!

I changed the script to call each mqsi... command in a separate call like this:

Code:

:: Normal processing starts here
ECHO *
ECHO * Backing up Broker %BRK%
ECHO *
ECHO *
ECHO * Setting the execution environment for %BRK%
ECHO *
CALL "C:\Program Files\IBM\MQSI\9.0.0.2\bin\mqsiprofile.cmd"
ECHO *
ECHO * Stop Broker %BRK%
ECHO *
CALL %BRK%_BKP_IN1_STOP_%BRK%.cmd
ECHO *
ECHO * Backup Broker %BRK%
ECHO *
CALL %BRK%_BKP_IN2_BACKUP_%BRK%.cmd
ECHO *
ECHO * Start Broker %BRK%
ECHO *
CALL %BRK%_BKP_IN3_START_%BRK%.cmd


The called scripts all contain the setlocal & endlocal before and after the mqsi... command

The setting of the mqsiprofile didn't seem to cause any harm and I also would have assumed that it has only effect in the shell started by the script and merely overvrites any previous path settings?

Now it works as desired

Thanks!
Back to top
View user's profile Send private message
Display posts from previous:
Post new topicReply to topic Page 1 of 1

MQSeries.net Forum IndexWebSphere Message Broker (ACE) Supportmqsi-commands behaves differently when used in a script
Jump to:



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP


Theme by Dustin Baccetti
Powered by phpBB 2001, 2002 phpBB Group

Copyright MQSeries.net. All rights reserved.