I'm writting a shell script and at the begining I login to sqlplus by
sqlplus -l user_name/password@instance
what I would like is to check if the database is down or not , and if the database has started moved to the next step else sleep for a certain time and then check again .
I know how to do the sleep part, but I don't know how to check if the database is not down. can some one help me please.
if [ `tbstat - | grep On-Line | wc -l` -eq 0 ]
then
echo Informix database seems to be down. Please start the database
echo do this do this
else
echo database is running
echo do this
fi
where tbstat is used to find database status...here you have to find out the command which gives status of your database....