Sun Cluster Geographic Edition System Administration Guide

Creating an Action Shell Script for Heartbeat-Loss

You can create an action shell script that runs when the local cluster detects a heartbeat-loss in the partner cluster. The script runs with root permissions. The file must have root ownership and execution permissions, but the script should not have write permissions.

If you have configured the Notification_actioncmd property, the action command runs with arguments that provide information about the event in the following command line:

# customactioncommandpath -c localclustername -r remoteclustername -e 1 \
-n nodename -t time

Specifies a path to the action command you have created.

-c localclustername

Specifies the name of the local cluster.

-p remoteclustername

Specifies the name of the remote partner cluster.


Specifies that HBLOST=1, which indicates that a heartbeat-loss event has occurred. The Sun Cluster Geographic Edition software only supports heartbeat-loss notification, so -e 1 is the only value that can be passed to the action shell script.


Specifies the name of the cluster node that sent the heartbeat-loss event notification.

-t timestamp

Specifies the time of the heartbeat-loss event as the number of milliseconds since January 1, 1970, 00:00:00 GMT.

Caution – Caution –

You can use this script to perform an automatic takeover on the secondary cluster. However, such an automated action is risky. If the heartbeat-loss notification is caused by a total loss of all heartbeat connectivity on both the primary and secondary clusters, such an automated action could lead to a situation where two primary clusters exist.

Example 6–11 How a Notification Action Script Parses the Command-Line Information Provided by the Sun Cluster Geographic Edition Software

This example displays the event information that is provided in the command-line being parsed in a notification action shell script.


set -- `getopt abo: $*`
if [ $? != 0]
      echo $USAGE
      exit 2

for i in $*

      case $i in
      -p)      PARTNER_CLUSTER=$1; shift;;
      -e)      HB_EVENT=$2; shift;;
      -c)      LOCAL_CLUSTER=$3; shift;;
      -n)      EVENT_NODE=$4; shift;;