On Wed, Oct 10, 2007 at 09:13:33AM -0400, Brooks, Jason wrote:
> All works well, but I want to capture any errors bpexpdate throws. Right
> now, here's what I'm doing:
> Return = WshShell.Run ("CMD.EXE /C
> D:\Progra~1\Veritas\NetBackup\bin\admincmd\bpexpdate.exe -d 0 -force -m "&
> Tape )
> sExpire.Write Tape & vbCrLf
> WScript.Sleep 60000
>
> What I want to see is when bpexpdate throws an error, log it to file. Right
> now, if I run bpexpdate on a tape in scratch, I get this:
>
> requested media id is not assigned to this host in the EMM database
>
> So, I've tried redirecting any output off the command line to the file, but
> it didn't work. When I run the same off the command line, I can't redirect
> output either.
>
> Can anyone else verify this? Know a way around it?
This is the difference between STDOUT and STDERR. Errors are often sent
to a separate stream so that they can be seen even if normal output is
hidden/captured, or so that the errors don't confuse a process reading
through the normal output. In a bourne/posix/bash shell, you can
redirect these streams indepenently.
$ program > /path/to/stdout.output 2> /path/to/stderr.output
Or you can place them in the same stream and just read that one.
$ program > /path/to/unified.output 2>&1
How you do this in your windows environment, I'm not sure. I would
assume that's a propery of WshShell.Run or the command.com that it
invokes? But here's a test program in perl. If you can redirect these
streams properly, you've got it.
perl -le "print STDOUT 'regular output'; print STDERR 'error output';"
--
Darren Dunham ddunham AT taos DOT com
Senior Technical Consultant TAOS http://www.taos.com/
Got some Dr Pepper? San Francisco, CA bay area
< This line left intentionally blank to confuse you. >
_______________________________________________
Veritas-bu maillist - Veritas-bu AT mailman.eng.auburn DOT edu
http://mailman.eng.auburn.edu/mailman/listinfo/veritas-bu
|