Operating System - HP-UX
1836932 Members
3262 Online
110111 Solutions
New Discussion

Re: Having trouble disabling monitoring of processess for a backup

 
Geoff Wild
Honored Contributor

Having trouble disabling monitoring of processess for a backup

We need to "disable" package failover during a "cold" backup of an Oracle DB.

I added a Function called: no_monitor_processes

This gives us the desired result, but we wind up with multiple copies of ilogp_oracle.sh running (as I call itself back with the monitor option).

If you kill any of the ilogp_oracle.sh pids, the package fail overs. Is there an easy way to fork a child process, kill the parent, but leave the child running?

I've attached the script.

Any ideas are welcome.

Thanks...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
7 REPLIES 7
harry d brown jr
Honored Contributor

Re: Having trouble disabling monitoring of processess for a backup

Have you tried using "nohup blahblahblah &"?

live free or die
harry
Live Free or Die
Geoff Wild
Honored Contributor

Re: Having trouble disabling monitoring of processess for a backup

Harry,

Yes, that is what I am doing now:

nohup ${0} monitor & # The script calls itself with the monitor option.

Thanks...
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Geoff Wild
Honored Contributor

Re: Having trouble disabling monitoring of processess for a backup

Managed to solve this on my own by:

Instead of restarting the script with nohup, I just recreate the array that holds the oracle pids.

If anyone is interested, I attached the script.


Here's the parts I changed:

###############################################################################
# Function: monitor_processes
#
# Monitor the Oracle processes by making sure that all required processes are
# running.
##############################################################################

function monitor_processes
{
print "\n *** getting pids ***"
get_monitor_processes_pid
sleep ${MONITOR_INTERVAL}

while true
do
if [[ -f ${NOMON} ]]
then
no_monitor_processes
else
for i in ${MONITOR_PROCESSES_PID[@]}
do
kill -s 0 ${i} > /dev/null
if [[ $? != 0 ]]
then
print "\n\n"
ps -ef
print "\n *** ${i} has failed. Aborting Oracle. ***"
set -m
nohup ${0} fault & # The script calls itself with the fault option.
set +m
sleep 999999
fi
done
sleep ${MONITOR_INTERVAL}
fi
done
}

###############################################################################
# Function: no_monitor_processes
#
# Do NOT Monitor the Oracle processes
#
##############################################################################

function no_monitor_processes
{
while true
do
if [[ -f ${LOCKF} ]]
then
print "\n *** $LOCKF exists - backup is running? - monitoring disabled. ***"
sleep ${MONITOR_INTERVAL}
else
print "\n *** getting new pids ***"
get_monitor_processes_pid
sleep ${MONITOR_INTERVAL}
fi
done
}

###############################################################################
# Function: get_monitor_processes_pid
#
# get the pid's of all the processes we are using
#
##############################################################################

function get_monitor_processes_pid
{
typeset -i n=0

for i in ${MONITOR_PROCESSES[@]}
do

MONITOR_PROCESSES_PID[$n]=`ps -fu oracle | awk '/'${i}$'/ { print $2 }'` #JAGad06432
print "Monitored process = ${i}, pid = ${MONITOR_PROCESSES_PID[$n]}"
if [[ ${MONITOR_PROCESSES_PID[$n]} = "" ]]
then
print "\n\n"
ps -ef
print "\n *** ${i} has failed at startup time. Aborting Oracle. ***"
set -m
nohup ${0} fault & # The script calls itself with the fault option.
set +m
sleep 999999
fi
(( n = n + 1 ))

done
}



Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
melvyn burnard
Honored Contributor

Re: Having trouble disabling monitoring of processess for a backup

Just for information, this precise topic and how to do it is covered in the MC/ServiceGuard II course, available from HP Education Centres.

http://education.hp.com/datasheets/h4310s.pdf
My house is the bank's, my money the wife's, But my opinions belong to me, not HP!
Geoff Wild
Honored Contributor

Re: Having trouble disabling monitoring of processess for a backup

Melvyn,

I looked at the "Hands On MC/Service Gaurd" there was only a simple test case in it - put me in the right direction.

BTW:

I changed the Function: no_monitor_processes
so that it didn't get stuck in its own loop by changing the while true to while [[ -f${LOCKF} ]]

Rgds...Geoff

###############################################################################
# Function: no_monitor_processes
#
# Do NOT Monitor the Oracle processes
#
##############################################################################

function no_monitor_processes
{
while [[ -f ${LOCKF} ]]
do
print "\n *** $LOCKF exists - backup is running? - monitoring disabled. ***"
sleep ${MONITOR_INTERVAL}
done
print "\n *** getting new pids ***"
get_monitor_processes_pid
sleep ${MONITOR_INTERVAL}
}
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Stephen Doud
Honored Contributor

Re: Having trouble disabling monitoring of processess for a backup

Please refer to document:
UXSGKBQA00000030
How to keep package file systems mounted after a package halt

-Stephen
Geoff Wild
Honored Contributor

Re: Having trouble disabling monitoring of processess for a backup

Stephen,

Just so you know, this is solved.

I did try to search for that document - couldn't find it....

The title may not be what I was looking for - we are not halting the package - we are disabling monitoring....

If you knoe where that document is online - then I wouldn't mine having a look....

Thanks...Geoff

Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.