Re: Make "exp" be quiet

From: Michael Schmarck <michael.schmarck_at_here.la>
Date: Thu, 06 Mar 2008 08:54:49 +0100
Message-ID: <1874687.Bf60B2klk4@michael-schmarck.my-fqdn.de>


Radoulov, Dimitre <cichomitiko_at_gmail.com> wrote:

> Michael Schmarck wrote:
> [...]

>> I'm using exp daily in a cron job to export data from a database.
>> In the cron job, I'm running:
>>
>> exp ${ora_user}/${ora_pass} FILE=/tmp/test.exp LOG=/tmp/test.exp.log \
>> DIRECT=Y FULL=Y STATISTICS=NONE > /dev/null
>>
>> But despite the "> /dev/null", exp writes something on the terminal.
> [...]

Can someone explain, why exp writes on stderr and not on stdout, as it should be?

>> How can I make "exp" shut up and only "say" something, when there's
>> an error? The problem with exp not being quiet is, that this produces
>> output and thus an email is triggered - I'd rather only get an email,
>> if there's an error.

> 
> 
> Something like this:
> 
> { exp $ora_user/$ora_pass FILE=/tmp/test.exp LOG=/tmp/test.exp.log \
> DIRECT=Y FULL=Y STATISTICS=NONE&&\
> fgrep "without warnings" /tmp/test.exp.log ;}>/dev/null 2>&1||\
> echo "An error occurred"|mailx -s "Yous subject" your_at_address

Hm. Is "exp" at least using status codes in a senseful way on Solaris? Ie., does it return 0 if everything went well and something else, if there was an error?

If so, then it should work to discard the output in case exp was successful (ie. it set status code to "0") and only print something, if it was not 0.

And if that's so, then your example seems to be strange - you're doing the fgrep only, if the exp command returned success (&&). Why are you doing that?

Michael Received on Thu Mar 06 2008 - 01:54:49 CST

Original text of this message