Author |
Message
|
MQAltaf |
Posted: Thu Feb 10, 2005 10:03 pm Post subject: Automate saveqmgr & move file into a CVS repository |
|
|
 Centurion
Joined: 10 Feb 2005 Posts: 119
|
Hi
As part of a DR solution I am wanting to write a script(s) to run saveqmgr, capture object authority and move the output file into a CVS repository such as Harvest or Visual SourceSafe.
Operating systems invloved - Unix, Solaris and Windows
Has anyone done this out there and if so could you share your experiences please?
Cheers |
|
Back to top |
|
 |
jsware |
Posted: Tue Feb 15, 2005 9:38 am Post subject: |
|
|
 Chevalier
Joined: 17 May 2001 Posts: 455
|
Yes, we have a scheduled job that runs every night. It uses a client compiled saveqmgr (saveqmgrc) program to save the definitions from all queue managers in our organisation.
Basically there is a list of hosts we have qmgrs on. The shell script works through this list calling another script to save the qmgr definitions. The second script then uses client connections to each known port number (we use standard port number ranges for multiple qmgrs). It gets saveqmgr to create/overwrite a file for each qmgr.
Once this is finished, the main script then adds new files to CVS and then does a commit for all the changes.
A couple of things to note:
Always make sure your saveqmgrc program is compiled against the latest version of the qmgr & latest CSD for the qmgr version you have anywhere. I had a time when the saveqmgrc program was compiled against an early CSD and later CSDs confused it causing the output MQS script to become invalid.
Use a consistent port number range (e.g. 1414 to 1450) - that way you can be sure that the script will pickup all qmgrs on a host because you know they'll be listening on a known range of ports.
You may wish to filter out comment lines (e.g. CRDATE/TIME & ALTDATE/TIME lines as these cause spurious updated when channels go active/inactive - this causes the transmission queue's GET attribute to change which causes extra updates. The latest version of saveqmgr puts some attributes in as comments (e.g passwords on some objects) so you might not want to filter out all comments.
You could create client connection definitions for each host on a local queue manager. You could then write a program to query that list (unfortunately the generated channel table file is binary). It should be quite easy with something along the lines of "DIS CHL(*) CHLTYPE(CLNTCONN) CONNAME" to get a list of connection names. You could then have one for each host (and scan the port range you use), or one for each qmgr.
Hope this helps. _________________ Regards
John
The pain of low quaility far outlasts the joy of low price. |
|
Back to top |
|
 |
MQAltaf |
Posted: Wed Feb 16, 2005 12:44 am Post subject: |
|
|
 Centurion
Joined: 10 Feb 2005 Posts: 119
|
John,
Thanks for the response.
Could you possibly share a sample script that you have created please?
Im a newbie and would appreciate a sample script.
Cheers |
|
Back to top |
|
 |
jsware |
Posted: Wed Feb 16, 2005 1:13 am Post subject: |
|
|
 Chevalier
Joined: 17 May 2001 Posts: 455
|
No problem, here's the loop that attempts each port number and saves the queue manager. This script, when put in a file accepts host names as parameters:
#!/bin/ksh
portlist="1414 1415 1416 1417 1418 1419"
for host in $*; do
echo "\nProcessing Host $host..."
for port in $portlist; do
export MQSERVER="SYSTEM.ADMIN.SVRCONN/TCP/$host($port)"
echo "\nLooking for Queue Manager on $MQSERVER..."
saveqmgrc -F -q -i -o REPLACE
done
done
The following script parses a file that contains a list of comments and host names found in a file called "qmgrhosts" in your home directory:
#!/bin/ksh
cat ~/qmgrhosts |&
while read -p line; do
comment=`echo "$line" | cut -c1`
if [[ -z "$line" || "$comment" = "#" ]]; then
echo "$line"
else
getqmgrs $line
fi
done _________________ Regards
John
The pain of low quaility far outlasts the joy of low price. |
|
Back to top |
|
 |
MQAltaf |
Posted: Wed Feb 16, 2005 1:19 am Post subject: |
|
|
 Centurion
Joined: 10 Feb 2005 Posts: 119
|
Cheers for the script...a few points.
I was thinking of creating a saveqmgr script file on each box and scheduling Tivoli to run the script on a daily basis. This would generate an output file which I would like to move into a CVS repository such as Harvest.
See script below...
#!/bin/ksh
#qmgrsave
# Script to automate collection of saveqmgr (MS03) output
# and perform housekeeping of the files.
# Input parameter is the name of the Queue Manager
# schedule using tivoli?
# set path where saveqmgr and find commands are.
PATH=.:/data/MQM/data10/scripts:/usr/bin/
export PATH
# Input arguments
QMGR=$1
# output path
lpath="/data/MQM/data10/defs/"
#date stamp for output file name
TODAY=$(/bin/date +%b-%d-%y)
# clear output file incase you want to run twice to same file
>${lpath}${QMGR}_$TODAY.tst
# run saveqmgr
saveqmgr -m $QMGR -f ${lpath}${QMGR}_$TODAY.tst
The only problem is that I dont know how to move the output file into Harvest....Any tips? |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Feb 16, 2005 5:12 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
well, if it was regular CVS, you could add some CVS commands to your script.
Similarly, if Harvest has a command line interface, then you can add those to your script. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
MQAltaf |
Posted: Wed Feb 16, 2005 7:12 am Post subject: |
|
|
 Centurion
Joined: 10 Feb 2005 Posts: 119
|
Thanks for the response.
I am not that familiar with Harvest and would be grateful if someone could possibly submit a sample script please?
Cheers |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Feb 16, 2005 7:21 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
MQAltaf wrote: |
I am not that familiar with Harvest |
Neither am I.
MQAltaf wrote: |
and would be grateful if someone could possibly submit a sample script please? |
Have you asked your Harvest administrator? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
|