RE: Capturing return error codes
Posted in 2015
Topics: Error Codes & Troubleshooting, Migration, Import/Export & Data Conversion, Platform-Specific Issues
Solaris 10
IDS 11.50.FC7
I have a script that was written for a company to do nightly unloads of data
from a production environment that can be used to load a test instance on the
same server. For the past couple of days, I have not received any error
messages; however, somehow the tape drive got turned off. Is there a better
way to check for the success of the command?
Approximate code
#! /bin/sh
onunload -s 409600000 -t /dev/rmt/1 prod_instance <<!
!
if [ "$?" -eq 0 ]
then
echo "Unload was successful"
else
echo "Unload was not successful"
mailx .................... command
exit
fi
(Continue processing)
So, although the tape drive was off, the if statement processed as successful.
Any ideas?
Thank you.
Larry
Try running before the onunload ?
mt -f /dev/tape status
Cheers
Paul
> -----Original Message-----
> From: ids-bounces@iiug.org [mailto:ids-bounces@iiug.org] On Behalf Of
> LARRY SORENSEN
> Sent: Wednesday, February 04, 2015 10:48 AM
> To: ids@iiug.org
> Subject: RE: Capturing return error codes [34559]
>
> Solaris 10
> IDS 11.50.FC7
>
> I have a script that was written for a company to do nightly unloads of
data
> from a production environment that can be used to load a test instance on
> the
> same server. For the past couple of days, I have not received any error
> messages; however, somehow the tape drive got turned off. Is there a
> better
> way to check for the success of the command?
>
> Approximate code
>
> #! /bin/sh
> onunload -s 409600000 -t /dev/rmt/1 prod_instance <<!>
> !
> if [ "$?" -eq 0 ]
> then
>
> echo "Unload was successful"
> else
>
> echo "Unload was not successful"
>
> mailx .................... command
>
> exit
> fi
>
> (Continue processing)
>
> So, although the tape drive was off, the if statement processed as
successful.
>
> Any ideas?
>
> Thank you.
>
> Larry
>
>
> **********************************************************
> *********************
> Forum Note: Use "Reply" to post a response in the discussion forum.
onunload is a bit broken... I've always considered it (personally) as
deprecated.
It should return a proper error if something went wrong.
From my perspective this beavior is a bug and you should try to open a PMR.
As an alternative, working with external tables could be fast and much more
usable.
Regards.
On Wed, Feb 4, 2015 at 5:48 PM, LARRY SORENSEN <lsorensen25@msn.com> wrote:
> Solaris 10
> IDS 11.50.FC7
>
> I have a script that was written for a company to do nightly unloads of
> data
> from a production environment that can be used to load a test instance on
> the
> same server. For the past couple of days, I have not received any error
> messages; however, somehow the tape drive got turned off. Is there a better
> way to check for the success of the command?
>
> Approximate code
>
> #! /bin/sh
> onunload -s 409600000 -t /dev/rmt/1 prod_instance <<!>
> !
> if [ "$?" -eq 0 ]
> then
>
> echo "Unload was successful"
> else
>
> echo "Unload was not successful"
>
> mailx .................... command
>
> exit
> fi
>
> (Continue processing)
>
> So, although the tape drive was off, the if statement processed as
> successful.
>
> Any ideas?
>
> Thank you.
>
> Larry
>
>
>
>
*******************************************************************************
> Forum Note: Use "Reply" to post a response in the discussion forum.
>
>
--
Fernando Nunes
Portugal
http://informix-technology.blogspot.com
My email works... but I don't check it frequently...
--001a11c21c70b586b3050e462957
Thank you.
I will give that a try.
Larry
> To: ids@iiug.org
> From: paul@oninit.com
> Subject: RE: Capturing return error codes [34560]
> Date: Wed, 4 Feb 2015 11:53:20 -0500
>
> Try running before the onunload ?
>
> mt -f /dev/tape status
>
> Cheers
> Paul
>
> > -----Original Message-----
> > From: ids-bounces@iiug.org [mailto:ids-bounces@iiug.org] On Behalf Of
> > LARRY SORENSEN
> > Sent: Wednesday, February 04, 2015 10:48 AM
> > To: ids@iiug.org
> > Subject: RE: Capturing return error codes [34559]
> >
> > Solaris 10
> > IDS 11.50.FC7
> >
> > I have a script that was written for a company to do nightly unloads of
> data
> > from a production environment that can be used to load a test instance on
> > the
> > same server. For the past couple of days, I have not received any error
> > messages; however, somehow the tape drive got turned off. Is there a
> > better
> > way to check for the success of the command?
> >
> > Approximate code
> >
> > #! /bin/sh
> > onunload -s 409600000 -t /dev/rmt/1 prod_instance <<!> >
> > !
> > if [ "$?" -eq 0 ]
> > then
> >
> > echo "Unload was successful"
> > else
> >
> > echo "Unload was not successful"
> >
> > mailx .................... command
> >
> > exit
> > fi
> >
> > (Continue processing)
> >
> > So, although the tape drive was off, the if statement processed as
> successful.
> >
> > Any ideas?
> >
> > Thank you.
> >
> > Larry
> >
> >
> > **********************************************************
> > *********************
> > Forum Note: Use "Reply" to post a response in the discussion forum.
>
>
>
*******************************************************************************
> Forum Note: Use "Reply" to post a response in the discussion forum.
>
sh t.ksh Please mount tape and press Return to continue ...Error opening the tape device, Error No. = 2. Please mount tape and press Return to continue ... read from stdin failed ... The unload has been aborted. errno = 0 failure [root]/tmp> echo $? 0 looks like you have to redirect stdout to a file and check the file. Mark