Hello,
Your script needs to check at which node the SCS is running, querying HACMP.
If the ERS is not running at the same node as the SCS, the script should return "0" (zero), as this would be the ERS running at the failover node.
And if the ERS is running at the same node as the SCS, the script should return "5" or any integer value higher than 5.
You can refer to the following SAP Help webpage:
http://help.sap.com/saphelp_NW70EHP1core/helpdata/en/47/ea3efa00e83b8be10000000a421937/frameset.htm
I'm not familiar on how could you query HACMP to get the name of the node at which the SCS is running, but the logic of the script should be simple:
SCSHOST=<return value of the query sent to HACMP>
if $SCSHOST = `hostname` then
exit 5
if $SCSHOST != `hostname` then
exit 0
I hope this helps.
Regards,
Isaías