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 its 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 which is already stopped is OK. We DEFINITELY will stop resources we don't think are running. Stop failures can result in the machine being rebooted to clear up the error.
Determine 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.
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.