Operating System - HP-UX
1834082 Members
2019 Online
110063 Solutions
New Discussion

Re: What happens if shutdown script "hangs"

 
Thomas Horner
New Member

What happens if shutdown script "hangs"

I am shutting down an Informix DB engine via the HP UX shutdown scripts. There
is a risk (though minor) that the command that shuts down the engine will
"hang" (the Informix engine will not respond).

If this happens in the middle of the shutdown sequence (the shutdown is
numbered K100informix in sbin/rc2.d), will the "hanging of the script" (since
there is no response) cause the shutdown sequence to hang, or is there some
kind of timeout, etc.?

If the shutdown hangs, I am thinking of coding another script called by the
first script to check if the Informix command has ended. If not, I would kill
the Informix command from this second script, thus enabling the first script to
continue. Does this sound feasible?

Thanks in advance.
3 REPLIES 3
Alan Riggs_1
Regular Advisor

Re: What happens if shutdown script "hangs"

Yes, it is possible for a shutdown script to hang, preventing th eshutdown from
continuing. There is no automaic timeout of which I am aware. As a rule, I
generally wrap my shutdown scripts with monitors which will either send out
page notification or kill relevant processes (depending upon the item which is
hung)
Robert Gamble_3
Regular Advisor

Re: What happens if shutdown script "hangs"

Alan,

Could you provide an example of a monitor script ?

Thanks!
Thomas Horner
New Member

Re: What happens if shutdown script "hangs"

Thanks for the response!

I also would to see your an example monitoring script that is in production.

This is the monitoring script I have coded, but NOT tested. It is started in
the background by the "informix.stop" shell, which is called from
/sbin/init.d/informix (K100informix). Is this the right direction?

#!/bin/sh
# %M% %I% of %G%
# %W%
###############################################################################
# checkinf.stop
###############################################################################
# Title: checkinf.stop
#
# This script checks the shutdown for informix to make sure it does not hang.
###############################################################################

# Capture Informix information from the .profile of the informix ID and
# execute it so that the database can be started.
INFHOME=`grep informix /etc/passwd | head -1 | cut -d: -f6`
grep INFORMIXSERVER ${INFHOME}/.profile > ${INFHOME}/.tmppro
grep INFORMIXDIR ${INFHOME}/.profile >> ${INFHOME}/.tmppro
grep ONCONFIG ${INFHOME}/.profile >> ${INFHOME}/.tmppro
. ${INFHOME}/.tmppro
rm ${INFHOME}/.tmppro
export PATH=$PATH:$INFORMIXDIR/bin

# Wait 150 seconds before checking status. Should be plenty of time for
# the onmode -ky command to finish.
sleep 150

ONMODE=`ps -ef | grep -c "onmode -ky"`
if [ ${ONMODE} -gt 1 ]
then
# Get process id of onmode and informix.stop and kill them.
ONMODEPID=`ps -fuinformix | grep "onmode -ky" | awk '{print $2}'`
INFSTOPID=`ps -fuinformix | grep "informix.stop" | awk '{print $2}'`
kill -15 $ONMODEPID
kill -15 $INFSTOPID
fi

# Wait 30 seconds before checking status again. Should be plenty of time for
# the kill -15 commands to finish.
sleep 30

ONMODE=`ps -ef | grep -c "onmode -ky"`
if [ ${ONMODE} -gt 1 ]
then
# Get process id of onmode and informix.stop and kill them.
ONMODEPID=`ps -fuinformix | grep "onmode -ky" | awk '{print $2}'`
INFSTOPID=`ps -fuinformix | grep "informix.stop" | awk '{print $2}'`
kill -9 $ONMODEPID
kill -9 $INFSTOPID
fi
exit 0