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 Discussion » Cannot get Windows redirect to work

Post new topic  Reply to topic
 Cannot get Windows redirect to work « View previous topic :: View next topic » 
Author Message
bbburson
PostPosted: Mon Oct 31, 2005 11:38 am    Post subject: Cannot get Windows redirect to work Reply with quote

Partisan

Joined: 06 Jan 2004
Posts: 378
Location: Nowhere near a queue manager

Here's an odd problem that I have not been able to find any information on. I hope the solution is evading me because of my Windows ignorance and not because of a technical limitation.

I have WMQ 5.3/csd10 running on a Windows 2003 server. I'm trying to set up scheduled tasks to save queue manager configuration (using saveqmgr) and authorization (using amqoamd) information. The scheduled tasks need to run under the same AD service account that runs the queue manager.

"saveqmgr" has the "-f" option to put its output into a file, and that works fine.

"amqoamd" does not have an output option, so I am trying to create an output file using Windows redirection ( > ). This will not work when run under the AD service account, even though it *does* work if I run it under my own login account. When I run it using the AD service account, the scheduled task information gets updated to show that it ran at the current time, but the output file does not get created. There are no indications in the event log what might have gone wrong.

Any thoughts, hints, suggestions? Nothing has turned up on this site or through several Google searches for "redirect", "run as", etc.

Thanks in advance,
Back to top
View user's profile Send private message
SAFraser
PostPosted: Mon Oct 31, 2005 11:47 am    Post subject: Reply with quote

Shaman

Joined: 22 Oct 2003
Posts: 742
Location: Austin, Texas, USA

If you run amqoamd manually under the AD account, does it create the output file?

Are you trying to write the output file to the same directory that the AD account is successfully writing the saveqmgr output to?

I use saveqmgr with Scheduled Tasks on a Windows box to save definitions from a bunch of Solaris boxes. The Solaris boxes use different service IDs for MQ, and I am forever fighting little security quirks when I set up my remote backup jobs. That's why I asked the questions above.

Shirley
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Mon Oct 31, 2005 11:48 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

I'd guess the AD user doesn't have permissions to create the file in the place you are asking it to be created.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
bbburson
PostPosted: Mon Oct 31, 2005 11:54 am    Post subject: Reply with quote

Partisan

Joined: 06 Jan 2004
Posts: 378
Location: Nowhere near a queue manager

Thanks for the quick response.

SAFraser wrote:
If you run amqoamd manually under the AD account, does it create the output file?

The service account is set up so that logins are not allowed, so I don't know a way to manually run amqoamd using that account. My personal account is also an AD account, and I can run the job fine using that account.
SAFraser wrote:
Are you trying to write the output file to the same directory that the AD account is successfully writing the saveqmgr output to?

Yes. I created a new subdirectory for the output files and gave the AD service account read/write/execute/modify privileges on it. The saveqmgr output goes there fine.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Mon Oct 31, 2005 12:03 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Then maybe amqoamd writes to stderr instead of stdout...
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
SAFraser
PostPosted: Mon Oct 31, 2005 12:36 pm    Post subject: Reply with quote

Shaman

Joined: 22 Oct 2003
Posts: 742
Location: Austin, Texas, USA

Jeff, He says he can run it with his own AD account and it will write to the file, so I think it must be writing to stdout (or did I miss your point)?

Bruce.... hmmm.... Does your AD account belong to exactly the same groups as the MQ service account? (mqm, administrators, whatever?)

My intuition says that a difference between your account and the MQ account is the culprit. Is the ability to logon the only difference between the two accounts? Gosh, why would that make a difference?

I don't suppose the AD administrator is a buddy of yours and you could experiment with the IDs at all? Had to ask.

Shirley
Back to top
View user's profile Send private message
bbburson
PostPosted: Tue Nov 01, 2005 1:28 pm    Post subject: Reply with quote

Partisan

Joined: 06 Jan 2004
Posts: 378
Location: Nowhere near a queue manager

My apologies for seeming to ignore your timely responses. I got caught up on some other troubles that had priority over this.

I seem to have gotten myself confused with what works and what doesn't work in all this, so I went back through and retested and now I think I have two separate issues. I'll try to articulate them here.

First, when setting up a Windows scheduled task, redirection of output DOES NOT WORK no matter which account I run the task under. I've tried it with "amqoamd" and "dspmq" and I've specified the redirection as "> filename" and "^> filename" (with and without a space after the ">" -- and without the quote marks).

So I created a ".cmd" file that contains the amqoamd command with redirection and told Scheduled Tasks to run the ".cmd" file. When I use my personal login account, this works and the output is correctly redirected. BUT, if I try to run the ".cmd" file under the service account, the Scheduled Task window shows "could not start."

I really need this to run under the service account so we don't have to keep up with periodic password updates or changes in assignments. The service account is what we run the queue manager under, so I'm somewhat at a loss what's going on here. I'm looking for local Windows expertise as well, but if you have any suggestions to try I'll certainly appreciate them.

Thanks,
Back to top
View user's profile Send private message
RogerLacroix
PostPosted: Tue Nov 01, 2005 3:58 pm    Post subject: Reply with quote

Jedi Knight

Joined: 15 May 2001
Posts: 3264
Location: London, ON Canada

FYI

http://www.microsoft.com/technet/scriptcenter/guide/sas_wsh_pkoy.mspx

You can twist the output of this one from a form to a file.
http://www.codeproject.com/csharp/LaunchProcess.asp

Or for the very basic stuff that I have (combine them together):
#1
Code:
Set shell = CreateObject("WScript.Shell")
command = "%comspec% /c dir>output.txt"
shell.Run command

Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile("output.txt")
s = f.ReadAll()
f.Close()
fso.DeleteFile("output.txt")]

n = InStr(1, s, "..")
MsgBox Right(s,Len(s)-n-1)


#2
Code:
Set shell = CreateObject("WScript.Shell")
command = "%comspec% /c dir"
Set scriptExec = shell.Exec(command)
MsgBox scriptExec.StdOut.ReadAll()


Regards,
Roger Lacroix
_________________
Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter
Back to top
View user's profile Send private message Visit poster's website
bbburson
PostPosted: Thu Nov 03, 2005 11:07 am    Post subject: ...got it working Reply with quote

Partisan

Joined: 06 Jan 2004
Posts: 378
Location: Nowhere near a queue manager

Thanks to all for the good information and advice. As we get more into a Windows environment I'm sure this stuff will become easier.

Here's what we did to get the redirection working and running under the correct AD service account:

-- the Scheduled Task command line is now set to be:

Code:
F:\MQsaves\cmd.exe /c "F:\MQsaves\saveauth.cmd ESBUSAOD1"


-- and the "start in" location is:

Code:
F:\MQsaves


Had to put a copy of "cmd.exe" in the MQsaves subdirectory so the service account has permission to use it.

The "saveauth.cmd" file does the actual amqoamd command with the output redirected. In that .cmd file we tried to use %1% for both the "-m queuemanager" part of the command and for the redirect file name:

Code:
amqoamd -m %1% -s > %1%.auth


, but that would not work, (it ends up trying to run:

Code:
amqoamd -m ESBUSAOD11.auth
)

... so we redirect to a temp file name first and then move that file to the final name using %1%.auth.

As you can tell, it's tough on us UNIXites to learn Windows stuff!
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 Discussion » Cannot get Windows redirect to work
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.