This file is indexed.

/usr/share/cluster/oralistener.sh is in resource-agents 1:3.9.7-1.

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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
#!/bin/bash
#
# Red Hat Cluster Suite resource agent for controlling Oracle 10g
# listener instances. This script will start, stop and monitor running
# listeners.
#
# start:    Will start given listener instance
#
# stop:     Will stop given listener instance
#
# monitor:  Will check that the listener is OK by calling lsnrctl status
#
#
# Copyright (C) 1997-2003 Sistina Software, Inc.  All rights reserved.
# Copyright (C) 2004-2013 Red Hat, Inc.  All rights reserved.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#

# Grab the global RHCS helper functions
. $(dirname $0)/ocf-shellfuncs
. $(dirname $0)/utils/config-utils.sh
. $(dirname $0)/utils/messages.sh
. $(dirname $0)/utils/ra-skelet.sh

declare -i	RESTART_RETRIES=3

ORACLE_USER=$OCF_RESKEY_user
ORACLE_HOME=$OCF_RESKEY_home
LISTENER=$OCF_RESKEY_name
[ -n "$OCF_RESKEY_tns_admin" ] && export TNS_ADMIN=$OCF_RESKEY_tns_admin

LC_ALL=C
LANG=C
PATH=$ORACLE_HOME/bin:/bin:/sbin:/usr/bin:/usr/sbin
export LC_ALL LANG PATH ORACLE_USER ORACLE_HOME

# clulog will not log messages when run by the oracle user.
# This is a hack to work around that.
if [ "`id -u`" = "`id -u $ORACLE_USER`" ]; then
	ocf_log() {
		prio=$1
		shift
		logger -i -p daemon."$prio" -- "$*"
	}
fi

verify_all() {
	ocf_log debug "Validating configuration for $LISTENER"

	if [ -z "$OCF_RESKEY_name" ]; then
		ocf_log error "Validation for $LISTENER failed: Invalid name of service (listener name)"
		return $OCF_ERR_ARGS
	fi

	if [ -z "$OCF_RESKEY_home" ]; then
		ocf_log error "Validation for $LISTENER failed: No Oracle home specified."
		return $OCF_ERR_ARGS
	fi

	if [ -z "$OCF_RESKEY_user" ]; then
		ocf_log error "Validation for $LISTENER failed: No Oracle username specified."
		return $OCF_ERR_ARGS
	fi
 
	# Super user? Automatically change UID and exec as oracle user.
	# Oracle needs to be run as the Oracle user, not root!
	if [ "`id -u`" = "0" ]; then
		su $OCF_RESKEY_user -c "$0 $*"
		exit $?
	fi

	# Make sure the lsnrctl binary is in our $PATH
	if [ ! -x $(which lsnrctl) ]; then
		ocf_log error "Validation for $LISTENER failed: Unable to locate lsnrctl command from path! ($PATH)"
		return $OCF_ERR_GENERIC
	fi

	ocf_log debug "Validation checks for $LISTENER succeeded"
	return 0
}

start() {
	ocf_log info "Starting listener $LISTENER"
	lsnrctl_stdout=$(lsnrctl start "$LISTENER")
	if [ $? -ne 0 ]; then
		ocf_log error "start listener $LISTENER failed $lsnrctl_stdout"
		return $OCF_ERR_GENERIC
	fi

	ocf_log info "Listener $LISTENER started successfully"
	return 0
}
 
stop() {
	ocf_log info "Stopping listener $LISTENER"

	monitor $OCF_CHECK_LEVEL
	if [ $? -ne 0 ]; then
		ocf_log info "Listener $LISTENER already stopped"
		return 0
	fi

	lsnrctl_stdout=$(lsnrctl stop "$LISTENER")
	if [ $? -ne 0 ]; then
		ocf_log debug "stop listener $LISTENER failed $lsnrctl_stdout"
		return $OCF_ERR_GENERIC
	fi

	ocf_log info "Listener $LISTENER stopped successfully"
	return 0
}
 
monitor() {
	declare -i depth=$1

	ocf_log debug "Checking status for listener $LISTENER depth $depth"
	lsnrctl status "$LISTENER" >& /dev/null
	if [ $? -ne 0 ]; then
		ocf_log error "Listener $LISTENER not running"
		return $OCF_ERR_GENERIC
	fi

	ocf_log debug "Listener $LISTENER is up"
	return 0 # Listener is running fine
}

recover() {
	ocf_log debug "Recovering listener $LISTENER"

	for (( i=$RESTART_RETRIES ; i; i-- )); do
		start
		if [ $? -eq 0 ] ; then
			ocf_log debug "Restarted listener $LISTENER successfully"
			break
		fi
	done

	if [ $i -eq 0 ]; then
		# stop/start's failed - return 1 (failure)
		ocf_log debug "Failed to restart listener $LISTENER after $RESTART_RETRIES tries"
		return 1
	fi

	status
	if [ $? -ne 0 ] ; then
		ocf_log debug "Failed to restart listener $LISTENER"
		return 1 # Problem restarting the Listener
	fi

	ocf_log debug "Restarted listener $LISTENER successfully"
	return 0 # Success restarting the Listener
}

case $1 in
	meta-data)
		cat `echo $0 | sed 's/^\(.*\)\.sh$/\1.metadata/'`
		exit 0
		;;
	verify-all)
		verify_all $*
		exit $?
		;;
	start)
		verify_all $* && start
		exit $?
		;;
	stop)
		verify_all $* && stop
		exit $?
		;;
	recover)
		verify_all $* && recover
		exit $?
		;;
	status|monitor)
		verify_all $*
		monitor $OCF_CHECK_LEVEL
		exit $?
		;;
	*)
		echo "Usage: $0 {start|stop|recover|monitor|status|meta-data|verify-all}"
		exit $OCF_ERR_GENERIC
		;;
esac