Operating System - HP-UX
1836952 Members
2068 Online
110112 Solutions
New Discussion

test_return in package control

 
SOLVED
Go to solution
Ryan Kogelheide
Frequent Advisor

test_return in package control

What does the function test_return in the function customer_defined_run_cmds do? (and where are the docs for this) Is there a way to indicate failure? What are the consequences when a non-zero return code results?

For example, if my run command is
su - oracle -c "/u01/app/oracle/BIN/startup.sh c7d52"

, I can get startup.sh to test for Oracle's pmon existence and return 1 perhaps. What are the consequences if I do?

Also, is there any way to get the cluster to watch for changes in the pmon existence to properly indicate the up/down status of Oracle?

Ryan
3 REPLIES 3
Solution

Re: test_return in package control

You can actually look at what test_return does, at the bottom of your package control script.

The short answer is that test_return expect $? to be zero if the application has started successfully if it doesn't guess what? test_return stops any services, runs your customer defined halt commands, and stops the package.

So make sure your getting a valid return code from the command before test_return.

Of course, if you have monitoring services defined, you may be checking that the application has started OK elsewhere, in which case test_return is not so important here, and you *could* comment it out - but as a believer in 'belt and braces' I wouldn't do that!

HTH

Duncan

I am an HPE Employee
Accept or Kudo
Robin Wakefield
Honored Contributor

Re: test_return in package control

Hi Ryan,

the test_return function is basically a clean way of handling the various errors that may occur whilst the package is starting/running/stopping. If you look at the logic, it should output an appropriate error message based on the function argument (if non-zero), then exit accordingly.

Rgds, Robin.

Re: test_return in package control

Missed your last question...

Yes, you can monitor whether pmon is running - this is what MC/SG services are for

T simplify things a touch, if you'd defined a service called ora_mon in you control script like this:

SERVICE_NAME[0]="ora_mon"
SERVICE_CMD[0]="/etc/cmcluster/oracle/ora_mon"
SERVICE_RESTART[0]=" "

ANd in your package configuration script like this:

SERVICE_NAME ora_mon
SERVICE_FAIL_FAST_ENABLED NO
SERVICE_HALT_TIMEOUT 0

And your script looked like this:

while true
do
ps -ef | grep -q [o]ra_pmon_sidname || exit
done

Then if Oracle crashed, and ora_pmon_whatever died, then the ora_mon process would detect this, and exit, and this would cause ServiceGuard to initiate a failover.

In practice people want to do much more than this, such as attempt recovery actions or not monitor during a cold backup or maintenance - but this really depends on your requirement.

HTH

Duncan





I am an HPE Employee
Accept or Kudo