| Author | 
		  Message
		 | 
		
		  | JosephGramig | 
		  
		    
			  
				 Posted: Thu Sep 01, 2011 12:11 pm    Post subject: A script to backup QMGRs | 
				     | 
			   
			 
		   | 
		
		
		    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 | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | gbaddeley | 
		  
		    
			  
				 Posted: Thu Sep 01, 2011 4:17 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    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 | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | Michael Dag | 
		  
		    
			  
				 Posted: Thu Sep 01, 2011 9:38 pm    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    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 | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | gouda | 
		  
		    
			  
				 Posted: Fri Sep 02, 2011 12:05 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    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 | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | JosephGramig | 
		  
		    
			  
				 Posted: Fri Sep 02, 2011 5:49 am    Post subject:  | 
				     | 
			   
			 
		   | 
		
		
		    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 | 
		  
		  	
		   | 
		
		
		    | 
		
		
		  | 
		    
		   |