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 » General IBM MQ Support » A script to backup QMGRs

Post new topic  Reply to topic
 A script to backup QMGRs « View previous topic :: View next topic » 
Author Message
JosephGramig
PostPosted: Thu Sep 01, 2011 12:11 pm    Post subject: A script to backup QMGRs Reply with quote

Grand Master

Joined: 09 Feb 2006
Posts: 1244
Location: Gold Coast of Florida, USA

I wrote the following script to go with MS03

Code:
#!/bin/ksh
# saveqmgr.sh
# backup MQ objects
Qmgr=$1
Retention=$2
echo
echo
echo QueueManager=$Qmgr Retention=$Retention
echo
echo
Today=$(/usr/bin/date +"%d%b%Y")
#
# Backup MQ objects and setauth settings
#
BackupDir='/var/mqm/config/backup'
mkdir -p $BackupDir
# Check to see if QMGR is running
Running=`dspmq|grep $Qmgr|grep Running|wc -l`
if [[ $Running -eq 0 ]]
then
        exit
fi
/var/mqm/config/saveqmgr -m $Qmgr -o -f $BackupDir'/'$Qmgr.MQSC.$Today -z $BackupDir'/'$Qmgr.AUT.$Today
cp /var/mqm/qmgrs/mqs.ini $BackupDir/mqs.ini.$Today
cp /var/mqm/qmgrs/$Qmgr/qm.ini $BackupDir/$Qmgr.qm.ini.$Today

#
# delete old backup
#
if [[ $Retention = '' ]]; then
      Retention=45
fi

find $BackupDir/$Qmgr.MQSC.* -mtime +$Retention -exec rm -f {} \;
find $BackupDir/$Qmgr.AUT.* -mtime +$Retention -exec rm -f {} \;
find $BackupDir/$Qmgr.qm.ini.* -mtime +$Retention -exec rm -f {} \;
find $BackupDir/mqs.ini.* -mtime +$Retention -exec rm -f {} \;


Of course, this is fine when the QMGR data path is the default. But sometimes it is not in the default path and the mqs.ini file contains the path. I was wondering if somebody had a handy way to get the path out of mqs.ini file in a easily consumable form. Too bad dspmq does not have an option for that.
Back to top
View user's profile Send private message AIM Address
gbaddeley
PostPosted: Thu Sep 01, 2011 4:17 pm    Post subject: Reply with quote

Jedi Knight

Joined: 25 Mar 2003
Posts: 2538
Location: Melbourne, Australia

You can still backup qm.ini and mqs.ini even if the qmgr is not running.

/var/mqm is not a particularly good place to store backups as its the same file system which contains the MQ data you are backup up!

There is other MQ stuff which can be backed up too, such as exits, SSL info, mqm's crontab, custom scripts.

You should also check that system backups include all MQ data. /var/mqm backups are really only useful if they are taken while the queue managers are down.
_________________
Glenn
Back to top
View user's profile Send private message
Michael Dag
PostPosted: Thu Sep 01, 2011 9:38 pm    Post subject: Reply with quote

Jedi Knight

Joined: 13 Jun 2002
Posts: 2607
Location: The Netherlands (Amsterdam)

you could try and use dspmqfls... each queue manager should have a default local queue, so

dspmqfls -m YourQMGR -t queue SYSTEM.DEFAULT.LOCAL.QUEUE
gives you the location of the queue file and so the path to the qmgr data.
_________________
Michael



MQSystems Facebook page
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
gouda
PostPosted: Fri Sep 02, 2011 12:05 am    Post subject: Reply with quote

Apprentice

Joined: 20 May 2001
Posts: 32
Location: Germany, Nuremburg

Hi Mike,
that's a nice way, i didn't even know of dspmqfls.

To get a value out of an ini file i always use Heiner Steven's cfget shell script:
http://www.shelldorado.com/scripts/names.html#Tab_C

Here is a snippet:
Code:

whatpath=`cfget .../qm.ini LogPath`
echo $whatpath


HTH
Back to top
View user's profile Send private message
JosephGramig
PostPosted: Fri Sep 02, 2011 5:49 am    Post subject: Reply with quote

Grand Master

Joined: 09 Feb 2006
Posts: 1244
Location: Gold Coast of Florida, USA

A friend suggested:

dspmqinf <qmgrname>|grep DataPath

Which will have the full path or be blank if default. This needs to work even if the QMGR is not running (even though you cannot run saveqmgr). Too bad we can't retrofit MQ V6 to have the dspmqinf... Would be good for the HA environments.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » General IBM MQ Support » A script to backup QMGRs
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.