5.3. Testing an Action Script

To test an action script, do the following:

  1. Create an input file, such as /tmp/input, that contains expected resource names. For example, to create a file that contains the resource named disk1 do the following:

    # echo "/disk1" > /tmp/input
  2. Create an input parameter file, such as /tmp/ipparamfile, as follows:

    # echo "ClusterName web-cluster" > /tmp/ipparamfile
  3. Execute the action script as follows:

    # ./start /tmp/input /tmp/output /tmp/ipparamfile

    Note: The use of the input parameter file is optional.

  4. Change the log level from HA_NORMLVL to HA_DBGLVL to allow messages written with HA_DBGLOG to be printed by adding the following line after the set_global_variables statement in your script:
    HA_CURRENT_LOGLEVEL=$HA_DBGLVL

The output file will contain one of the following return values for the start, stop, monitor, and restart scripts:

HA_SUCCESS=0
HA_INVAL_ARGS=1
HA_CMD_FAILED=2
HA_NOTSUPPORTED=3
HA_NOCFGINFO=4

The output file will contain one of the following return values for the exclusive script:

HA_NOT_RUNNING=0
HA_RUNNING=2

Note: If you call the exit_script function prior to normal termination, it should be preceded by the ha_write_status_for_resource function and you should use the same return code that is logged to the output file.

Suppose you have a resource named /disk1 and the following files:

The following example shows:

For additional information about a script's processing, see the /var/log/failsafe/script_nodename.