This file is indexed.

/usr/share/cluster/nfsexport.sh is in resource-agents 1:3.9.2-5ubuntu4.

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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
#!/bin/bash

#
# NFS Export Script.  Handles starting/stopping clurmtabd and doing
# the strange NFS stuff to get it to fail over properly.
#
#
# 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.
#

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

. $(dirname $0)/ocf-shellfuncs


rmtabpid=""
nfsop_arg=""
rv=0

meta_data()
{
	cat <<EOT
<?xml version="1.0" ?>
<resource-agent name="nfsexport" version="rgmanager 2.0">
    <version>1.0</version>

    <longdesc lang="en">
        This defines an NFS export path.  Generally, these are
        defined inline and implicitly; you should not have to 
        configure one of these.  All of the relevant information
        is inherited from the parent.
    </longdesc>

    <shortdesc lang="en">
        This defines an NFS export.
    </shortdesc>

    <parameters>
        <parameter name="name" primary="1">
            <longdesc lang="en">
                Descriptive name for this export.  Generally, only
                one export is ever defined, and it's called "generic
                nfs export".
            </longdesc>
            <shortdesc lang="en">
                Name
            </shortdesc>
	    <content type="string"/>
        </parameter>

        <parameter name="device" inherit="device">
            <longdesc lang="en">
                If you can see this, your GUI is broken.
            </longdesc>
            <shortdesc lang="en">
                If you can see this, your GUI is broken.
            </shortdesc>
	    <content type="string"/>
        </parameter>

        <parameter name="path" inherit="mountpoint">
            <longdesc lang="en">
                If you can see this, your GUI is broken.
            </longdesc>
            <shortdesc lang="en">
                If you can see this, your GUI is broken.
            </shortdesc>
	    <content type="string"/>
        </parameter>

        <parameter name="fsid" inherit="fsid">
            <longdesc lang="en">
                If you can see this, your GUI is broken.
            </longdesc>
            <shortdesc lang="en">
                If you can see this, your GUI is broken.
            </shortdesc>
	    <content type="string"/>
        </parameter>
    </parameters>

    <actions>
        <action name="start" timeout="5"/>
	<action name="stop" timeout="5"/>
	<action name="recover" timeout="5"/>

	<!-- NFS Exports really don't do anything except provide a path
	     for nfs clients.  So, status and monitor are no-ops -->
	<action name="status" timeout="5" interval="1h"/>
	<action name="monitor" timeout="5" interval="1h"/>

	<action name="meta-data" timeout="5"/>
	<action name="validate-all" timeout="30"/>
    </actions>

    <special tag="rgmanager">
	<child type="nfsexport" forbid="1"/>
	<child type="nfsclient"/>
    </special>

</resource-agent>
EOT
}


verify_device()
{
	if [ -z "$OCF_RESKEY_device" ]; then
	       ocf_log err "No device or label specified."
	       return $OCF_ERR_ARGS
	fi

	[ -b "$OCF_RESKEY_device" ] && return 0
	[ -b "`findfs $OCF_RESKEY_device`" ] && return 0

	ocf_log err "Device or label \"$OCF_RESKEY_device\" not valid"

	return $OCF_ERR_ARGS
}


verify_path()
{
	if [ -z "$OCF_RESKEY_path" ]; then
		ocf_log err "No export path specified."
		return $OCF_ERR_ARGS
	fi

	[ -d "$OCF_RESKEY_path" ] && return 0

	ocf_log err "$OCF_RESKEY_path is not a directory"
	
	return $OCF_ERR_ARGS
}


verify_all()
{
	declare -i ret=0

	verify_device || ret=$OCF_ERR_ARGS
	verify_path || ret=$OCF_ERR_ARGS

	return $ret
}


#
# Check if the NFS daemons are running.
#
nfs_daemons_running()
{
    declare NFS_DAEMONS="nfsd rpc.mountd rpc.statd"

    for daemon in $NFS_DAEMONS; do
        ps -ef | grep "$daemon" | grep -v grep >/dev/null 2>&1
        if [ $? -ne 0 ]; then
	    ocf_log err \
            "NFS daemon $daemon is not running."
	    ocf_log err \
            "Verify that the NFS service run level script is enabled."
            return 1
        fi
    done

    return 0
}


nfs_check()
{
	declare junk

	if nfs_daemons_running; then
		return 0
	fi

	#
	# Don't restart daemons during status check.
	#
	if [ "$1" = "status" ]; then
		return 1;
	fi
		
  	ocf_log err "Restarting NFS daemons"
	# Note restart does less than stop/start
	junk=$(/sbin/service nfslock stop)
	junk=$(/sbin/service nfslock start)
	junk=$(/sbin/service nfs stop)
	junk=$(/sbin/service nfs start)
	sleep 2
	
	if ! nfs_daemons_running; then
		ocf_log err "Failed restarting NFS daemons"
    		return 1
	fi
	ocf_log notice "Successfully restarted NFS daemons"
}


case $1 in
start)
	nfs_check start || exit 1
	rv=0
	;;

status|monitor)
	nfs_check status || exit 1
	rv=0
	;;
		    
stop)
	nfs_check restart || exit 1
	rv=0
	;;

recover|restart)
	$0 stop || exit $OCF_ERR_GENERIC
	$0 start || exit $OCF_ERR_GENERIC
	rv=0
	;;

meta-data)
	meta_data
	rv=0
	;;

validate-all)
	verify_all
	rv=$?
	;;
*)
	echo "usage: $0 {start|status|monitor|stop|recover|restart|meta-data|validate-all}"
	exit $OCF_ERR_UNIMPLEMENTED
	;;
esac

exit $rv