Operating System - HP-UX
1832550 Members
6067 Online
110043 Solutions
New Discussion

Serv Guard calling startup scripts

 
SOLVED
Go to solution
Mike_316
Frequent Advisor

Serv Guard calling startup scripts

Hey Gang,

Quick question for verification. I understand that SG, by standard configuration, is used to start a process using the process's command entered into the configuration file, and then monitor that process's PID for failure. In the event the PID it grabbed when starting the process goes away, the process is restarted.

I also understand, that if you use the configuration file and have SG call a startup script (instead of the command directly), it will capture the PID of the SCRIPT it called, and get into a loop when the script exits (as the PID goes away) and attempt to call the script again.

My solution to this NORMALLY would be to have SG call a startup script but NOT monitor the PID of anything (just monitor for machine failure via heartbeat.) HOWEVER...is it possible to have SG call a STARTUP SCRIPT and then monitor the processes CALLED BY THE SCRIPT (instead of the scriptG??s PID directly?) And, if it can, can it then be configured to run the STOP SCRIPT (killing all associated processes) and call the startup script again in the event the actuall process's fail?

Thanks for the help!!

Mike
"If we treated each person we met as if they were carrying an unspeakable burden, we might treat each other as we should" - Dale Carnegie
5 REPLIES 5
melvyn burnard
Honored Contributor
Solution

Re: Serv Guard calling startup scripts

Hmm, slightly confused, But I believe what you are asking this:
If I have a Service Script that is used by the package to monitor vital processes/resource, Can I montor the PID's of the processes started from inside this script rather than hte script PID itself?

The answer is no.
The Service Monitor logs the PID of the Service Process command/script and monitors that. The script internally will be doing things like checking for a PID, or that a file exists, and while it does, then all is well. If the file or PID disappears, then you could possibly script in the logic to restart the missing process/create the file, but there are some caveats to be mindful of in doing this. Essentially, if the PID dissappears, or the file goes missing (or whatever) then the script does an exit. Upon this process exiting, the Service Monitor then sees the service has died. If a restart is configured, it will restart that service process, but if the required resources are still missing, it will die again. The Service Monitor then tells the Package Manager that there has been a failure, and proceeds to halt the package, and if it can restart the package on an alternate node.

For more info you may want to read the Managing MC/ServiceGuard manual at:
http://docs.hp.com/hpux/ha
My house is the bank's, my money the wife's, But my opinions belong to me, not HP!
John Palmer
Honored Contributor

Re: Serv Guard calling startup scripts

If you used the exec command in your startup script to call your application then that process would replace your startup script and execute as the same PID.

Regards,
John
Mike_316
Frequent Advisor

Re: Serv Guard calling startup scripts

GREAT ANSWERS! That pretty much answered the question, and is what I thought (although I didn't know about using exec to replace the PID...that WILL be helpful.)

So the only question I have left (mostly for verification to make sure I understand the manual right) is ...it IS possible to configure SG to start a process, and NOT monitor it at all ...correct? In other words, configure it to run process/script "X", and then ignore the PID (or monitor the PID, but do nothing if it dissappears.)

I hope that makes sense, and thanks again for all the help!

Mike
"If we treated each person we met as if they were carrying an unspeakable burden, we might treat each other as we should" - Dale Carnegie
Christopher McCray_1
Honored Contributor

Re: Serv Guard calling startup scripts

Hello,

Basically, yes. The only way SG will monitor an application/PID, is if you tell it to. The way you do that is defining the monitor in the package config and control scripts as a Service Process.

Hope this answers you question

Chris
It wasn't me!!!!
Mike_316
Frequent Advisor

Re: Serv Guard calling startup scripts

It does! Thanks again for all the help!

Mike
"If we treated each person we met as if they were carrying an unspeakable burden, we might treat each other as we should" - Dale Carnegie