Hi again, family.
I previously posted about someone using the exit status of onstat to
determine the state of the online system:
> ========================= CUT HERE ========================
> $ cat /usr/local/bin/engine
> :
> onstat - 1>/dev/null 2>&1
> stat=$?
> if test $stat -eq 1> then
> 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 ========================
IMO, the above does not qualify as "well enough" for me to leave it
alone. I have come up with what I believe *is* well enough and does not
depend on a quirk.
$ onstat -d | head -2|tail -1|awk '{print $5}'
This grabs the second line of onstat output (the first is a blank line)
and pulls the 5th string in the heading line.
This is not without assumptions but it these are less likely to change
and easier to roll with:
1. The state of the system - "On-Line", "Off-Line", "Quiescent", etc.
will always be in position 5 of the heading line.
2. The heading line containing the state of the system will always be
the second line.
I still invite comments from C.D.I. regarding the exit codes from
onstat; it has piqued my curiosity. I simply would not depend on this
quirk to determine the state of the system.
Answers anyone?
--
-- Jake (In pursuit of undomesticated 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) -+