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 Index » WebSphere Message Broker (ACE) Support » running several mqsistopmsgflow in a single script file

Post new topic  Reply to topic
 running several mqsistopmsgflow in a single script file « View previous topic :: View next topic » 
Author Message
ruimadaleno
PostPosted: Mon Mar 23, 2015 1:42 am    Post subject: running several mqsistopmsgflow in a single script file Reply with quote

Master

Joined: 08 May 2014
Posts: 274

Hi all,

i've built a script to stop several message flows in several execution groups.

The script is run from command console (so the profile is imported) but only the first command is run and the script exits ...

script:

Code:

@echo off

rem --------------------------------------------------------
rem descricao: script para stop de message flows no execution group default
rem
rem --------------------------------------------------------
REM

SET BROKER_NAME=BRKDVESB01A
SET EXECUTION_GROUP=default
SET DEPLOY_WAIT=600


echo ..................................
echo script iniciado as %TIME% de %DATE%


mqsistopmsgflow %BROKER_NAME% -e %EXECUTION_GROUP% -k emailws -m gen.EmailWS -w %DEPLOY_WAIT%
mqsistopmsgflow %BROKER_NAME% -e %EXECUTION_GROUP% -k smsws -m gen.SmsWS -w %DEPLOY_WAIT%
mqsistopmsgflow %BROKER_NAME% -e %EXECUTION_GROUP% -k FileNetWS_V2 -m FileNetWS -w %DEPLOY_WAIT%


mqsistopmsgflow %BROKER_NAME% -e %EXECUTION_GROUP% -k SGMBEntities -m gen.Entities -w %DEPLOY_WAIT%
mqsistopmsgflow %BROKER_NAME% -e %EXECUTION_GROUP% -k SGMBPolicies -m gen.Policies -w %DEPLOY_WAIT%
mqsistopmsgflow %BROKER_NAME% -e %EXECUTION_GROUP% -k SGMBPoliciesChanges -m gen.PoliciesChanges -w %DEPLOY_WAIT%
mqsistopmsgflow %BROKER_NAME% -e %EXECUTION_GROUP% -k SGMBReceipts -m gen.Receipts -w %DEPLOY_WAIT%



mqsistopmsgflow %BROKER_NAME% -e %EXECUTION_GROUP% -k EurotaxWS -m gen.EurotaxWS -w %DEPLOY_WAIT%
mqsistopmsgflow %BROKER_NAME% -e %EXECUTION_GROUP% -k RotasAutenticacao -m gen.RotasAutenticacao -w %DEPLOY_WAIT%
mqsistopmsgflow %BROKER_NAME% -e %EXECUTION_GROUP% -k RotasGestao -m gen.RotasGestao -w %DEPLOY_WAIT%
mqsistopmsgflow %BROKER_NAME% -e %EXECUTION_GROUP% -k RotasInfo -m RotasInfo -w %DEPLOY_WAIT%


mqsistopmsgflow %BROKER_NAME% -e %EXECUTION_GROUP% -k AcoreanaCreateProcessWFProducao -m acoreana.CreateProcessWFProducao -w %DEPLOY_WAIT%
mqsistopmsgflow %BROKER_NAME% -e %EXECUTION_GROUP% -k SIGACreateProcess -m acoreana.siga.esb.ps.SIGACreateProcessProxyService -w %DEPLOY_WAIT%


mqsistopmsgflow %BROKER_NAME% -e %EXECUTION_GROUP% -k ScoringAuto -m gen.ScoringAuto -w %DEPLOY_WAIT%
mqsistopmsgflow %BROKER_NAME% -e %EXECUTION_GROUP% -contact admin  -m gen.contact admin -w %DEPLOY_WAIT%

mqsistopmsgflow %BROKER_NAME% -e %EXECUTION_GROUP% -k SibsPRT  -w %DEPLOY_WAIT%
mqsistopmsgflow %BROKER_NAME% -e %EXECUTION_GROUP% -k BPMGestRecBroker -w %DEPLOY_WAIT%


echo script Finished at %TIME% at %DATE% com nivel de erro: %ERRORLEVEL%
echo ..................................


script output:

Code:


C:\BarFiles\reorg>script_stop_message_flow_eg_default.bat
..................................
script iniciado as  9:41:18,72 de 23-03-2015
BIP1028I: Stopping message flow 'gen.EmailWS' on execution group 'default' (Appl
ication 'emailws', Library '')...
BIP1031I: Message flow 'gen.EmailWS' on execution group 'default' is reported as
 stopped. (Application 'emailws', Library '')
BIP8071I: Successful command completion.

C:\BarFiles\reorg>



what is wrong with this script ?
_________________
Best regards

Rui Madaleno
Back to top
View user's profile Send private message
ruimadaleno
PostPosted: Mon Mar 23, 2015 2:10 am    Post subject: Reply with quote

Master

Joined: 08 May 2014
Posts: 274

i've manage to find a solution

solution: add an "cmd /c " before each msqistopmsgflow command

Code:

@echo off

rem --------------------------------------------------------

SET BROKER_NAME=BRKDVESB01A
SET EXECUTION_GROUP=default
SET DEPLOY_WAIT=600

echo.
echo MQSI %MQSI_VERSION%
echo %MQSI_FILEPATH%
echo.



echo ..................................
echo script iniciado as %TIME% de %DATE%


cmd /c mqsistopmsgflow %BROKER_NAME% -e %EXECUTION_GROUP% -k emailws -m gen.EmailWS -w %DEPLOY_WAIT%
cmd /c mqsistopmsgflow %BROKER_NAME% -e %EXECUTION_GROUP% -k smsws -m gen.SmsWS -w %DEPLOY_WAIT%
cmd /c mqsistopmsgflow %BROKER_NAME% -e %EXECUTION_GROUP% -k FileNetWS_V2 -m gen.FileNetWS -w %DEPLOY_WAIT%


cmd /c mqsistopmsgflow %BROKER_NAME% -e %EXECUTION_GROUP% -k SGMBEntities -m gen.Entities -w %DEPLOY_WAIT%
cmd /c mqsistopmsgflow %BROKER_NAME% -e %EXECUTION_GROUP% -k SGMBPolicies -m gen.Policies -w %DEPLOY_WAIT%
cmd /c mqsistopmsgflow %BROKER_NAME% -e %EXECUTION_GROUP% -k SGMBPoliciesChanges -m gen.PoliciesChanges -w %DEPLOY_WAIT%
cmd /c mqsistopmsgflow %BROKER_NAME% -e %EXECUTION_GROUP% -k SGMBReceipts -m gen.Receipts -w %DEPLOY_WAIT%



cmd /c mqsistopmsgflow %BROKER_NAME% -e %EXECUTION_GROUP% -k EurotaxWS -m gen.EurotaxWS -w %DEPLOY_WAIT%
cmd /c mqsistopmsgflow %BROKER_NAME% -e %EXECUTION_GROUP% -k RotasAutenticacao -m gen.RotasAutenticacao -w %DEPLOY_WAIT%
cmd /c mqsistopmsgflow %BROKER_NAME% -e %EXECUTION_GROUP% -k RotasGestao -m gen.RotasGestao -w %DEPLOY_WAIT%
cmd /c mqsistopmsgflow %BROKER_NAME% -e %EXECUTION_GROUP% -k RotasInfo -m gen.RotasInfo -w %DEPLOY_WAIT%


cmd /c mqsistopmsgflow %BROKER_NAME% -e %EXECUTION_GROUP% -k AcoreanaCreateProcessWFProducao -m acoreana.CreateProcessWFProducao -w %DEPLOY_WAIT%
cmd /c mqsistopmsgflow %BROKER_NAME% -e %EXECUTION_GROUP% -k SIGACreateProcess -m acoreana.siga.esb.ps.SIGACreateProcessProxyService -w %DEPLOY_WAIT%


cmd /c mqsistopmsgflow %BROKER_NAME% -e %EXECUTION_GROUP% -k ScoringAuto -m gen.ScoringAuto -w %DEPLOY_WAIT%
cmd /c mqsistopmsgflow %BROKER_NAME% -e %EXECUTION_GROUP% -k contact admin  -m gen.contact admin -w %DEPLOY_WAIT%

cmd /c mqsistopmsgflow %BROKER_NAME% -e %EXECUTION_GROUP% -k SibsPRT  -w %DEPLOY_WAIT%
cmd /c mqsistopmsgflow %BROKER_NAME% -e %EXECUTION_GROUP% -k BPMGestRecBroker -w %DEPLOY_WAIT%


echo script Finished at %TIME% at %DATE% com nivel de erro: %ERRORLEVEL%
echo ..................................


Now another problem

if one of the mqsistopmsflowcommand generates an error, how does the script returns this error ?

In the end of the script i use "echo %ERRORLEVEL%" to ouput the error level, but this is the error from the last command issued. what is the best way to store the errors happening in the middle of the script ?
_________________
Best regards

Rui Madaleno
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Mar 23, 2015 4:25 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

This is why your solution with cmd /c is a little bit over the top.

Replace your cmd /c with call. That should do it. At the same time %errorlevel% will be set to the exit value of the batch called.

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
smdavies99
PostPosted: Mon Mar 23, 2015 6:05 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 a number of mqsi* commands that 'work' like this.

mqsicreateexecutiongroup is another.

I solve this by writing the mqsicommand to a temporary .bat file and calling it.
I also wrap the command in an setlocal/endlocal structure.

I find this behaviour rather annoying. It would be nice if IBM resolved it...
_________________
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
fjb_saper
PostPosted: Mon Mar 23, 2015 7:13 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

smdavies99 wrote:
There are a number of mqsi* commands that 'work' like this.

mqsicreateexecutiongroup is another.

I solve this by writing the mqsicommand to a temporary .bat file and calling it.
I also wrap the command in an setlocal/endlocal structure.

I find this behaviour rather annoying. It would be nice if IBM resolved it...

That's going a little bit overboard too.

Instead of writing mqsicreateexecutiongroup into your batch file, just write call mqsicreateexecutiongroup. No need to create another layer with the temp file...
You may have a point with the setlocal / endlocal commands however my understanding is that the mere execution of some of the mqsi*.exe command may also change your environment (look at mqsisetmqenv.bat and mqsifindmqpath.exe)
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » running several mqsistopmsgflow in a single script file
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.