1760597 Members
3607 Online
108894 Solutions
New Discussion юеВ

Re: restart on same host

 
Keith Floyd
Advisor

restart on same host

Hi

Can I restart a failed package on the host that failed ??

How do I fo this in the config

Thanks

Keith
7 REPLIES 7
John Palmer
Honored Contributor

Re: restart on same host

Hi Keith,

Yes, you will need to run cmmodpkg to enable the package on the host that failed:-

cmmodpkg -e -n

then

cmrunpkg -n

Regards,
John
Keith Floyd
Advisor

Re: restart on same host

Thanks John

I am more after SG to do this - can this be put in SG's scripts ??

where ??

Basically I want it try to restart on the same node after failure

Thanks

Keith
John Palmer
Honored Contributor

Re: restart on same host

In the package control script, you have the option to specify the array variable

SERVICE_RESTART[n]

This can be:-
null - no restart
-r n - n restarts
-R infinite number of restarts.

Is this what you are after?

Regards,
John
Byron Myers
Trusted Contributor

Re: restart on same host

Keith,
If I understand your question correctly, then edit the package run script - this is identified in the package control script created by the cmmakepkg command - line entry "RUN_SCRIPT" in the package control script defines the package run script. You need to isolate the "exit " lines of code in the run script. My script uses the HP supplied function "test_return" as the location to exit with various non-zero values. A non-zero value will mean that the package start failed, so at these exit locations, instead of exiting, retry running the functions and/or other scripts that failed. I would keep a counter as a variable like "NUM_RETRIES", and after a certain number of start retries (like 2), then I would exit with a positive value - indicating a package start failure.
If you can focus your eyes far and straight enough ahead of yourself, you can see the back of your head.
Keith Floyd
Advisor

Re: restart on same host

Thanks so far - not quite there yet ...

In the setup here under SERVIVE_RESTART is process monitor scripts,

What I want is for the process that is monitored to be restarted (if it can) on the host it failed on - before it moves to the secondary host. There is not issue with data corruption in this setup, I just want to try to stop user disconnections for a flaky process

Keith

John Waller
Esteemed Contributor

Re: restart on same host

This is a ServiceGuard monitoring script I wrote for a ORACLE webdb listener which kept stopping for no reason. If the process has stopped instead of switching the package it just performs another start. Combine this with the restart option set to infinate and I think this is what you are looking for.


while true
do
if
ps -ef | grep -v grep | grep -q "wdblsnr oraclelive 2255"
then
sleep 30
else
/etc/cmcluster/oraclelive/webdb.sh start
exit
fi
done
John Waller
Esteemed Contributor

Re: restart on same host

P.S
In the above script webdb.sh is the name of a script which starts the webdb listener and not the name of the monitoring script itself.