[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-ha-dev
Subject:    Re: [Linux-ha-dev] Adding a command to be executed at takeover time?
From:       Alan Robertson <alanr () unix ! sh>
Date:       2003-04-14 21:35:12
[Download RAW message or body]

edmund mitchell wrote:
> Hello all
> 
> I'd like heartbeat to send a command to the system when it takes over - 
> specifically, to add a route.
> 
> I thought I could just add the commands into the ha source, and recompile.
> 
> I'm very much a newb to this whole concept, so I'm hoping someone could 
> tell me which file & function executes when the heartbeat on a system 
> senses that it's time to takeover. I just want ha to do it's normal 
> thing, and then add my route, and go on doing what it does so well.
> 
> I searched the archives for topics I thought related, and came up empty.
> 
> Thanks for any help, or, if this seems a terrible idea, any pointers.

You're just making it too hard ;-)

Write a resource script which does what you want and place it in 
/etc/ha.d/resource.d.  Then, configure in the resource script into 
/etc/ha.d/haresources.

Key things to remember:

	Resource scripts are like init scripts - they need to handle
		start, stop and status operations.

The status operation is a little odd - the return code from the status 
operation is ignored, and the message printed is used instead.

If the output of "status" has the word "OK" or "running" in it, then the 
resource is assumed to be running.  Otherwise, it is assumed to be not 
running.  If you get this wrong, heartbeat will be confused - and so will 
you ;-)

I'm pretty sure there's info on this in the docs.


-- 
     Alan Robertson <alanr@unix.sh>

"Openness is the foundation and preservative of friendship....  Let me claim 
from you at all times your undisguised opinions." - William Wilberforce

_______________________________________________________
Linux-HA-Dev: Linux-HA-Dev@lists.community.tummy.com
http://lists.community.tummy.com/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic