Exit status of onstat
Posted in 1997
Hi family,
I have been seeing lots opf bashing of informix tools because the exit
status of the various programs does not follow conventions that help
shell scripts recover from errors.
I recently found the following shell script at my site. It is called at
the beginning of a night job that operates more efficiently in quiescent
mode.
========================= CUT HERE ========================
$ cat /usr/local/bin/engine
:
onstat - 1>/dev/null 2>&1
stat=$?
if test $stat -eq 1then
echo "Quiescent"
exit 1
fi
if test $stat -eq 5
then
echo "Online"
exit 5
fi
if test $stat -eq 255
then
echo "Offline"
exit 255
fi
========================= CUT HERE ========================
Criticisms of the shell script aside (whatsamatta? Ya neveh hueid of
case statements?), this appears to be depending on a quirk that someone
happened upon: The exit code of onstat is a different value depending on
the state of the OnLine system.
Is this documented anywhere? I don't see any mention of this in the
OnLine Admin Guide and I'm really leery about basing a whole cron job
operation on this oscure quirk. I would have preferred the knowing
comfort of a shell/awk/perl script that scans the heading lines of the
onstat output.
Thanks.
--
-- Jake (In pursuit of Brooklynese semi-aquatic avians)
+---------------------------------------------------------------+
|Insofar as manifestations of functional deficiencies are agreed|
|by any and all concerned parties to be imperceivable, and are |
|so stipulated, it is incumbent upon said heretofore mentioned |
|parties to exercise the deferment of otherwise pertinent |
|maintenance procedures. |
+--------------------------------------- (www.hardyharhar.com) -+