Any one know this?
Posted in 1999
Topics: General Discussion
Hi folks: Is there a script that can check informix on-line dynamic server is up and running or not? If not it will e-mail a note to D.B.A. groups Thanks in advance Garry
cheng wrote:
> Is there a script that can check informix on-line dynamic server
> is up and running or not? If not it will e-mail a note to D.B.A.
> groups
If you can assume the environment is OK, then you can use
a minor variant on:
x=`onstat -`
case $? in
0) msg="";;
1) msg="Server is quiescent";;
# I' not sure that 1 is quiescent, but...
2) msg="Server is ...";;
...
*) msg="Server is in an unknown state: $x";;
esac
if [ -n "$msg" ]
then
echo $msg | mail -s "$x" dba-group
fi
--
Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net)
Guardian of DBD::Informix v0.60 -- see http://www.perl.com/CPAN
#include <disclaimer.h>
In whatever shell you are using set a variable equal to `onstat -|grep
OnLine|wc -l`
if the variable = 1 then the engine is up and running.
Jonathan Leffler wrote:
> cheng wrote:
> > Is there a script that can check informix on-line dynamic server
> > is up and running or not? If not it will e-mail a note to D.B.A.
> > groups
>
> If you can assume the environment is OK, then you can use
> a minor variant on:
>
> x=`onstat -`
> case $? in
> 0) msg="";;
> 1) msg="Server is quiescent";;
> # I' not sure that 1 is quiescent, but...
> 2) msg="Server is ...";;
> ...
> *) msg="Server is in an unknown state: $x";;
> esac
>
> if [ -n "$msg" ]
> then
> echo $msg | mail -s "$x" dba-group
> fi
>
> --
> Jonathan Leffler (jleffler@informix.com, jleffler@earthlink.net)
> Guardian of DBD::Informix v0.60 -- see http://www.perl.com/CPAN
> #include <disclaimer.h>
Doug McAllister wrote:
>
> In whatever shell you are using set a variable equal to `onstat -|grep
> OnLine|wc -l`
> if the variable = 1 then the engine is up and running.
You mean:
onstat -|grep "On-Line"|wc -l
Informix Dynamic Server Version 7.30.UC6 -- On-Line -- Up 00:43:44 -- 13296
Kbytes
The other way is to check the return-code of onstat:
oninit;sleep5;onstat -;echo $?
(should be 5)
onmode -sy;onstat -;echo $?
(should be 4)
Markus