Author |
Message
|
vaddireddy kranthi kumar |
Posted: Thu May 19, 2011 12:49 am Post subject: automating back up with saveqmgr |
|
|
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 |
|
 |
Mr Butcher |
Posted: Thu May 19, 2011 1:40 am Post subject: |
|
|
 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 |
|
 |
ramires |
Posted: Thu May 19, 2011 1:57 am Post subject: Re: automating back up with saveqmgr |
|
|
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 |
|
 |
mqjeff |
Posted: Thu May 19, 2011 3:02 am Post subject: Re: automating back up with saveqmgr |
|
|
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 |
|
 |
ramires |
Posted: Thu May 19, 2011 3:10 am Post subject: Re: automating back up with saveqmgr |
|
|
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 |
|
 |
mqjeff |
Posted: Thu May 19, 2011 4:19 am Post subject: Re: automating back up with saveqmgr |
|
|
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 |
|
 |
gbaddeley |
Posted: Thu May 19, 2011 4:38 pm Post subject: Re: automating back up with saveqmgr |
|
|
 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 |
|
 |
ramires |
Posted: Fri May 20, 2011 1:52 am Post subject: Re: automating back up with saveqmgr |
|
|
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 |
|
 |
vaddireddy kranthi kumar |
Posted: Fri May 20, 2011 9:19 pm Post subject: thankyou |
|
|
Newbie
Joined: 26 Apr 2011 Posts: 3
|
thankyou all for your replies, atlast i was able to get what i want...
 |
|
Back to top |
|
 |
|