This file is indexed.

/etc/ha.d/resource.d/OCF is in heartbeat 1:3.0.6-2.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#!/bin/sh
#
# Copyright: (C) 2003 International Business Machines Corporation
# Author:	Alan Robertson <alanr@unix.sh>
# License:      GNU General Public License (GPL)
# Support:      linux-ha@lists.linux-ha.org
#

#
#	OCF resource agent wrapper script for "original" heartbeat
#	resource system
#
#	This allows heartbeat to use OCF resource agents.
#
#	They are configured in /etc/ha.d/haresources like this:
#
#	OCF::resource-type::resource-instance-name
#
#	Note that resource-type must be a script in the ${OCF_AGENTS} directory
#	and that resource-instance-name must be a configuration file in
#	${HA_DIR}/conf/OCF/OCF-resource-name/
#

HA_HBCONF_DIR=/etc/ha.d

# Source function library.
. $HA_HBCONF_DIR/shellfuncs

# ${HA_DIR} is where things show up
# ${HA_DIR}/conf/OCF is where we find our resource settings.
#	One directory per resource type
#
# ${OCF_AGENTS} is a directory above where OCF resource agent scripts
#	are found
#
#
usage() {
	cat <<-! >&2
	usage: $0 OCF-resource-name OCF-instance-name operation-name

	OCF-resource-name is the name of an OCF-compliant resource agent
	script found under an immediate subdirectory of ${OCF_AGENTS}

	OCF-instance-name is the name of an instance of OCF-resource-name.
	It corresponds to an instance conf file named
	${HA_DIR}/conf/OCF/OCF-resource-name/OCF-instance-name

	operation-name is one of:
		start
		stop
		status
		monitor

	!
	exit 1
}

#
#	Official OCF environment variable names
#
OCF_RES_VERSION_MAJOR=1
OCF_RES_VERSION_MAJOR=0
OCF_RES_NAME=$2
export OCF_RES_VERSION_MAJOR OCF_RES_VERSION_MAJOR OCF_RES_NAME

ocf_catvars()
{
  cat $Resource_Inst_File | sed -e 's%#.*%%' -e 's%^[ 	]*%%' | grep '.'
}

ocf_varnames()
{
  ocf_catvars | grep '=' | sed 's%=.*%%'
}

ocf_setvars()
{
  . $Resource_Inst_File
  for j in `ocf_varnames`
  do
    eval export $j
  done
}

ocf_op() {
  (
    ocf_setvars
    $Resource_Script $1
  )
}

rname()
{
  echo "OCF Resource $Resource_Name::$Resource_Instance"
}

ocf_status() {
  statoutput=`OCF_STATUS_QOS=0 ocf_op status`
  rc=$?
  case $statoutput in
    "")	;;
    *)  ha_log "info: $statoutput"
  esac
  if
    [ $rc -eq 0 ]
  then
    case $statoutput in
      *OK*|*running*)	echo $statoutput;;
      *)		echo "`rname` is running"
			;;
    esac
    return 0
  else
    case $statoutput in
      *OK*|*running*)	echo "`rname` is stopped"
			;;
      *)		echo "$statoutput";;
    esac
    return $rc
  fi
}

ocf_monitor()
{
  OCF_STATUS_QOS=10 ocf_op status
}

if
  [ $# -ne 3 ]
then
  usage
fi

Resource_Name=$1
Resource_Instance=$2
Operation=$3
Resource_Inst_File="${HA_DIR}/conf/OCF/${Resource_Name}/${Resource_Instance}"
Resource_Script=`ls ${OCF_AGENTS}/*/${Resource_Name} 2>/dev/null | head -n 1`


if
  [ ! -f "$Resource_Script" -o ! -x "$Resource_Script" -o \
    ! -f "$Resource_Inst_File" ]
then
  usage
fi


case $Operation in
  status)	ocf_status;;
  monitor)	ocf_monitor;;
  *)		ocf_op $Operation;;
esac