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 » automating back up with saveqmgr

Post new topic  Reply to topic
 automating back up with saveqmgr « View previous topic :: View next topic » 
Author Message
vaddireddy kranthi kumar
PostPosted: Thu May 19, 2011 12:49 am    Post subject: automating back up with saveqmgr Reply with quote

Newbie

Joined: 26 Apr 2011
Posts: 3

hi,

a) My requirement is to automate the saveqmgr to back up the queuemanager onto a file with date-stamp on the file .(env is windows 2003)


Last edited by vaddireddy kranthi kumar on Tue May 31, 2011 10:07 pm; edited 1 time in total
Back to top
View user's profile Send private message
Mr Butcher
PostPosted: Thu May 19, 2011 1:40 am    Post subject: Reply with quote

Padawan

Joined: 23 May 2005
Posts: 1716

this sounds like homework

however, are you aware that saveqmgr "only" saves the object definitions into a file, and does not take a backup of the qmgr ?!?
_________________
Regards, Butcher
Back to top
View user's profile Send private message
ramires
PostPosted: Thu May 19, 2011 1:57 am    Post subject: Re: automating back up with saveqmgr Reply with quote

Knight

Joined: 24 Jun 2001
Posts: 523
Location: Portugal - Lisboa

vaddireddy kranthi kumar wrote:
has -f option to give the file name but am not able to append the date\time stamp onto the file.

The file created has a timestamp. With the -f the file name will be <queue manager name>.mqsc and the file has the creation date and time.

Or you can play with DOS environment variables DATE and TIME to define the file name.
_________________
Obrigado / Thanks you
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu May 19, 2011 3:02 am    Post subject: Re: automating back up with saveqmgr Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

ramires wrote:
vaddireddy kranthi kumar wrote:
has -f option to give the file name but am not able to append the date\time stamp onto the file.

The file created has a timestamp. With the -f the file name will be <queue manager name>.mqsc and the file has the creation date and time.

Or you can play with DOS environment variables DATE and TIME to define the file name.


If you run saveqmgr twice, with the -f option given the same value, then the second attempt will overwrite the first attempt.

But I agree that the file produced will have a timestamp that reflects this....

Your second suggestion is the correct route here, use normal shell scripting techniques to produce a unique file name that is then passed to -f. Whether or not this includes the date and time is a separate question.

I suppose one could also use normal shell scripting techniques to check in a file that has a fixed name into a version control system. the VCS would then be responsible for ensuring that the first run was available as well as the second run. But it was not clear if that is what you were suggesting.
Back to top
View user's profile Send private message
ramires
PostPosted: Thu May 19, 2011 3:10 am    Post subject: Re: automating back up with saveqmgr Reply with quote

Knight

Joined: 24 Jun 2001
Posts: 523
Location: Portugal - Lisboa

mqjeff wrote:
If you run saveqmgr twice, with the -f option given the same value, then the second attempt will overwrite the first attempt.

The second run appends the output to the existing file, the flag "-o" can be used to overwrite.
_________________
Obrigado / Thanks you
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu May 19, 2011 4:19 am    Post subject: Re: automating back up with saveqmgr Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

ramires wrote:
mqjeff wrote:
If you run saveqmgr twice, with the -f option given the same value, then the second attempt will overwrite the first attempt.

The second run appends the output to the existing file, the flag "-o" can be used to overwrite.

You would think that I'd know that off the top of my head.
Back to top
View user's profile Send private message
gbaddeley
PostPosted: Thu May 19, 2011 4:38 pm    Post subject: Re: automating back up with saveqmgr Reply with quote

Jedi Knight

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

ramires wrote:
...Or you can play with DOS environment variables DATE and TIME to define the file name.


Yeah, something like this:
Code:
set qmgrname=YOURQMGRNAME

rem Generate YYYYMMDD date stamp
set today=%date:~10%%date:~7,2%%date:~4,2%

saveqmgr.exe -m %qmgrname% -o -f %qmgrname%.%today%.defs.txt -z %qmgrname%.%today%.oam.txt

_________________
Glenn
Back to top
View user's profile Send private message
ramires
PostPosted: Fri May 20, 2011 1:52 am    Post subject: Re: automating back up with saveqmgr Reply with quote

Knight

Joined: 24 Jun 2001
Posts: 523
Location: Portugal - Lisboa

gbaddeley wrote:
ramires wrote:
...Or you can play with DOS environment variables DATE and TIME to define the file name.


Yeah, something like this:
Code:
set qmgrname=YOURQMGRNAME

rem Generate YYYYMMDD date stamp
set today=%date:~10%%date:~7,2%%date:~4,2%

saveqmgr.exe -m %qmgrname% -o -f %qmgrname%.%today%.defs.txt -z %qmgrname%.%today%.oam.txt


Very good! Or like this

set "QmgrName=<queue manager>"
set "TimeStamp=%date%%time%"
set "TimeStamp=%TimeStamp:-=%
set "TimeStamp=%TimeStamp::=%
set "TimeStamp=%TimeStamp:,=%

saveqmgr -m <queue manager> -f %QmgrName%.%TimeStamp%.mqsc
_________________
Obrigado / Thanks you
Back to top
View user's profile Send private message
vaddireddy kranthi kumar
PostPosted: Fri May 20, 2011 9:19 pm    Post subject: thankyou Reply with quote

Newbie

Joined: 26 Apr 2011
Posts: 3

thankyou all for your replies, atlast i was able to get what i want...

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

MQSeries.net Forum Index » General IBM MQ Support » automating back up with saveqmgr
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.