ADSM-L

How to capture errors when running client commands from scripts

2004-03-11 00:10:07
Subject: How to capture errors when running client commands from scripts
From: StorageGroupAdmin StorageGroupAdmin <StorageGroupAdmin AT SYDNEYWATER.COM DOT AU>
To: ADSM-L AT VM.MARIST DOT EDU
Date: Thu, 11 Mar 2004 16:09:32 +1100
-----------------------------------------------------------
This email is to be read subject to the disclaimer below.
-----------------------------------------------------------

I am trying to create a script to perform an incremental / selective
backup via batch.

During my testing I executed the client command with a syntax error
which generate the appropriate error.

However, what I did discovered is that my script which was reading the
output from the command did not 'see' the error message.

What occurred was the typical messages when to stdout  however the
error went to stderr (as it should)

Though the stderr can be re-directed in stdout it is not written in the
correct order, ie the stderr output appears at the end of the stdout
output list.
This a problem because the error message is typically associated with
the preceding stdout message.

eg

<stdout> Starting backup of blah
<stderr> Directory blah not found

So if the error message is not in the right position in the output you
cannot associate it the object for which it was generated.



Can anyone offer a solution?

I have tried (in Perl & REXX) ;

  piping the entire output to a file - stderr is not redirected or is
out of order depending on the re-direction

  using the Unix back-quotes & redirecting

  piping stderr into stdout (2>&1)

  disabled buffering


Regards



Peter Griffin
Sydney Water

peter.griffin AT sydneywater.com DOT au





-----------------------------------------------------------
Mandatory water restrictions now apply in Sydney, Blue Mountains and the 
Illawarra. Fines of $220 apply from 1 November 2003. No sprinklers or watering 
systems at any time. No hosing of hard surfaces including vehicles at any time. 
For more information visit www.sydneywater.com.au
-----------------------------------------------------------
NOTICE: This email is confidential. If you are not the nominated recipient, 
please immediately delete this email, destroy all copies, and inform the 
sender. Sydney Water Corporation (Sydney Water) prohibits the unauthorised 
copying or distribution of this email. This email does not necessarily express 
the views of Sydney Water. Sydney Water does not warrant nor guarantee that 
this email communication is free from errors, virus, interception or 
interference.
-----------------------------------------------------------

<Prev in Thread] Current Thread [Next in Thread>
  • How to capture errors when running client commands from scripts, StorageGroupAdmin StorageGroupAdmin <=