This file is indexed.

/usr/share/cluster/oralistener.sh is in resource-agents 1:3.9.3+git20121009-3ubuntu2.

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
#!/bin/bash
#
# $Id: oralistener.sh 127 2009-08-21 09:17:52Z hevirtan $
#
# 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-2011 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

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

verify_all() {
    clog_service_verify $CLOG_INIT

    if [ -z "$OCF_RESKEY_name" ]; then
        clog_service_verify $CLOG_FAILED "Invalid name of service (listener name)"
        return $OCF_ERR_ARGS
    fi

    if [ -z "$OCF_RESKEY_home" ]; then
        clog_service_verify $CLOG_FAILED "No Oracle home specified."
        return $OCF_ERR_ARGS
    fi

    if [ -z "$OCF_RESKEY_user" ]; then
        clog_service_verify $CLOG_FAILED "No Oracle username specified."
        return $OCF_ERR_ARGS
    fi
        
    # Make sure the lsnrctl binary is in our $PATH
    if [ ! -x $(which lsnrctl) ]; then
        clog_service_verify $CLOG_FAILED "oralistener:${OCF_RESKEY_home}: Unable to locate lsnrctl command from path! ($PATH)"
        return $OCF_ERR_GENERIC
    fi

    clog_service_verify $CLOG_SUCCEED
    return 0
}

start () {
    clog_service_start $CLOG_INIT
    
    logfile="/tmp/oracle_lsn.$$"
    su -p - $ORACLE_USER -c "lsnrctl start $LISTENER > $logfile"

    initlog -q -c "cat $logfile"
    rm -f $logfile

    clog_service_start $CLOG_SUCCEED
    return 0
}
 
stop () {
    clog_service_stop $CLOG_INIT
    
    logfile="/tmp/oracle_lsn.$$"
    su -p - $ORACLE_USER -c "lsnrctl stop $LISTENER > $logfile"

    initlog -q -c "cat $logfile"
    rm -f $logfile

    clog_service_stop $CLOG_SUCCEED
    return 0
}
 
monitor () {
    clog_service_status $CLOG_INIT
    
    su -p - $ORACLE_USER -c "lsnrctl status $LISTENER"
    rv=$?
    if [ $rv == 0 ]; then
        clog_service_status $CLOG_SUCCEED
	    return 0 # Listener is running fine
    else
        clog_service_status $CLOG_FAILED
        return $OCF_ERR_GENERIC
    fi
}

recover() {
	for (( i=$RESTART_RETRIES ; i; i-- )); do
		start
		if [ $? == 0 ] ; then
		    break
		fi
	done

	if [ $i -eq 0 ]; then
		# stop/start's failed - return 1 (failure)
		return 1
	fi

    status
	if [ $? != 0 ] ; then
		return 1 # Problem restarting the Listener
	fi

	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
        exit $?
        ;;
    *)
        echo "Usage: $0 {start|stop|recover|monitor|status|meta-data|verify-all}"
        exit $OCF_ERR_GENERIC
        ;;
esac