This file is indexed.

/usr/lib/ocf/resource.d/heartbeat/Pure-FTPd 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
#!/bin/sh
#
# Resource script for Pure-FTPd
#
# Description:  Manages Pure-FTPd as an OCF resource in 
#		an Active-Passive High Availability setup.
#
# Author:	Rajat Upadhyaya <urajat@novell.com> : Pure-FTPd script
# Author:	Raoul Bhatia <r.bhatia@ipax.at>     : Minor Cleanup. Added Debian GNU/Linux Support
# License:      GNU General Public License (GPL) 
#
#
#	usage: $0 {start|stop|status|monitor|validate-all|meta-data}
#
#	The "start" arg starts Pure-FTPd.
#
#	The "stop" arg stops it.
#
# OCF parameters:
#  OCF_RESKEY_script
#  OCF_RESKEY_conffile
#  OCF_RESKEY_daemon_type
#  OCF_RESKEY_pidfile
#
##########################################################################
# Initialization:

: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat}
. ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs

: ${OCF_RESKEY_script="/sbin/pure-config.pl"}
script_basename=`basename $OCF_RESKEY_script`
: ${OCF_RESKEY_conffile="/etc/pure-ftpd/pure-ftpd.conf"}
: ${OCF_RESKEY_daemon_type=""}
: ${OCF_RESKEY_pidfile="${HA_RSCTMP}/pure-ftpd-${OCF_RESOURCE_INSTANCE}.pid"}
USAGE="Usage: $0 {start|stop|status|monitor|validate-all|meta-data}";

##########################################################################

usage() {
	echo $USAGE >&2
}

meta_data() {
        cat <<END
<?xml version="1.0"?>
<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
<resource-agent name="Pure-FTPd">
<version>1.0</version>
<longdesc lang="en">
This script manages Pure-FTPd in an Active-Passive setup
</longdesc>
<shortdesc lang="en">Manages a Pure-FTPd FTP server instance</shortdesc>

<parameters>

<parameter name="script" unique="1" required="0">
<longdesc lang="en">
The full path to the Pure-FTPd startup script. 
For example, "/sbin/pure-config.pl"
</longdesc>
<shortdesc lang="en">Script name with full path</shortdesc>
<content type="string" default="/sbin/pure-config.pl" />
</parameter>

<parameter name="conffile" unique="1" required="0">
<longdesc lang="en">
The Pure-FTPd configuration file name with full path. 
For example, "/etc/pure-ftpd/pure-ftpd.conf"
</longdesc>
<shortdesc lang="en">Configuration file name with full path</shortdesc>
<content type="string" default="/etc/pure-ftpd/pure-ftpd.conf" />
</parameter>

<parameter name="daemon_type" unique="1" required="0">
<longdesc lang="en">
The Pure-FTPd daemon to be called by pure-ftpd-wrapper.
Valid options are "" for pure-ftpd, "mysql" for pure-ftpd-mysql, 
"postgresql" for pure-ftpd-postgresql and "ldap" for pure-ftpd-ldap
</longdesc>
<shortdesc lang="en">Configuration file name with full path</shortdesc>
<content type="string" default="" />
</parameter>

<parameter name="pidfile" unique="0">
<longdesc lang="en">PID file</longdesc>
<shortdesc lang="en">PID file</shortdesc>
<content type="string" default="${HA_RSCTMP}/pure-ftpd-${OCF_RESOURCE_INSTANCE}.pid" />
</parameter>

</parameters>

<actions>
<action name="start"   timeout="20s" />
<action name="stop"    timeout="20s" />
<action name="monitor" depth="0"  timeout="20s" interval="60s" />
<action name="validate-all"  timeout="20s" />
<action name="meta-data"  timeout="5s" />
</actions>
</resource-agent>
END
        exit $OCF_SUCCESS
}

isRunning()
{
	kill -s 0 "$1" > /dev/null
}

PureFTPd_status()
{
	if [ -f $OCF_RESKEY_pidfile ]
	then
	# Pure-FTPd is probably running
		PID=`head -n 1 $OCF_RESKEY_pidfile`
		if [ ! -z $PID ] ; then
			isRunning "$PID" && [ `ps -p $PID | grep pure-ftpd | wc -l` -eq 1 ]
			return $?
		fi
	fi
	
	# Pure-FTPd is not running
	false
}

PureFTPd_start()
{
  #
  # make a few checks and start Pure-FTPd
  #
  	if ocf_is_root ; then : ; else
                ocf_log err "You must be root."
                exit $OCF_ERR_PERM
        fi
	
  # if Pure-FTPd is running return success

	if PureFTPd_status ; then
		exit $OCF_SUCCESS
	fi

	# check that the Pure-FTPd script exists and can be executed
	if [ ! -x "$OCF_RESKEY_script" ]; then
		ocf_log err "Pure-FTPd script '$OCF_RESKEY_script' does not exist or cannot be executed"
		exit $OCF_ERR_GENERIC
	fi

	# test for pure-ftpd-wrapper (e.g. Debian GNU/Linux Systems)
	if [ "$script_basename" = "pure-ftpd-wrapper" ]; then
		# pure-ftpd-wrapper expects STANDALONE_OR_INETD to be set to standalone
		STANDALONE_OR_INETD=standalone $OCF_RESKEY_script $OCF_RESKEY_daemon_type
	else
		# check that the Pure-FTPd config file exist
		if [ ! -f "$OCF_RESKEY_conffile" ]; then
			ocf_log err "Pure_FTPd config file '$OCF_RESKEY_conffile' does not exist"
			exit $OCF_ERR_GENERIC
		fi

		$OCF_RESKEY_script $OCF_RESKEY_conffile -g $OCF_RESKEY_pidfile
	fi
  
	if [ $? -ne 0 ]; then
		ocf_log info "Pure-FTPd returned error" $?
		exit $OCF_ERR_GENERIC
	fi

	exit $OCF_SUCCESS
}


PureFTPd_stop()
{
	if PureFTPd_status ; then
		PID=`head -n 1 $OCF_RESKEY_pidfile`
		if [ ! -z $PID ] ; then
			kill $PID
		fi
	fi

	exit $OCF_SUCCESS
}

PureFTPd_monitor()
{

  if PureFTPd_status ; then
	return $OCF_SUCCESS
  fi

  return $OCF_NOT_RUNNING
}

PureFTPd_validate_all()
{

  return $OCF_SUCCESS
}

#
# Main
#

if [ $# -ne 1 ]
then
  usage
  exit $OCF_ERR_ARGS
fi

case $1 in
    start)	PureFTPd_start
		;;
	
    stop)	PureFTPd_stop
    		;;
		
    status)	if PureFTPd_status
    		then
			ocf_log info "Pure-FTPd is running"
			exit $OCF_SUCCESS
		else
			ocf_log info "Pure-FTPd is stopped"
			exit $OCF_NOT_RUNNING
		fi
    		;;
		
    monitor)	PureFTPd_monitor
    		exit $?
    		;;
		
    validate-all)	PureFTPd_validate_all
    			exit $?
    			;;
			
    meta-data)	meta_data
  		;;
		
    usage)	usage
    		exit $OCF_SUCCESS
		;;
		
    *)		usage
 		exit $OCF_ERR_UNIMPLEMENTED
		;;
esac