The Classic Heartbeat resource agents (scripts) are basically LSB init scripts - with slightly odd status operations. The only operations on the resource scripts which Heartbeat performs are:
These operations are as follows:
Activate the given resource.
According to the LSB, it is never an error to start an already active resource. Exit with 0 on success, nonzero on failure. Heartbeat will only start a resource if it wants it to be running on the current machine, and status shows it's not already running. Heartbeat will never start the same resource at the same time in different nodes in the cluster.
Deactivate the given resource.
Performed when we want to make sure a resource is not running. Although there are occasions when we check to see if a resource is running before stopping it, during shutdown, we will stop all resources whether or not we think they're running.
According to the LSB, stopping a resource which is already stopped is always permissible. Heartbeat will DEFINITELY stop resources it doesn't know is running. Stop failures can result in the machine being rebooted to clear up the error. Note that some Red Hat init scripts are not LSB-compliant and complain when trying to stop resources which are not running.
Determine running status of the given resource.
The status operation has to really report status correctly, AND, it has to print either OK or running when the resource is active, and it CANNOT print either of those when it's inactive. For the status operation, we ignore the return code.
This sounds quite odd, but it's a historical hangover for compatibility with earlier versions of Linux which didn't reliably give proper status exit codes, but they did print OK or running reliably.
Heartbeat calls the status operation in many places. We do it before starting any resource, and also (IIRC) when releasing resources.
After repeated stop failures, we will do a status on the resource. If the status reports that the resource is still running, then we will reboot the machine to make sure things are really stopped. Note that this behaviour is only with the old resource manager of v1 (haresources based) clusters. CRM/v2 clusters use stonith.
Start, stop and status operations are NEVER overlapped on a given resource on a given machine. You don't have to worry about concurrency of an operation on a resource.
Unlike an LSBResourceAgent, a HeartbeatResourceAgent can be passed a list of positional parameters. The parameters go before the operation name, like this:
IPaddr 10.10.10.1 start
The haresources line which corresponds to this set of parameters is:
IPaddr::10.10.10.1
and invoked with the start operation.
Heartbeat looks for resource scripts in /etc/ha.d/resource.d and /etc/init.d.
ResourceAgent, HeartbeatProgram, haresources, LSBResourceAgent, OCFResourceAgent