| 1 |
#!/bin/sh |
| 2 |
# event strict to manage vsftpd in a cluster environment |
| 3 |
|
| 4 |
[ -n "$CTDB_BASE" ] || \ |
| 5 |
CTDB_BASE=$(d="$(dirname "$0")" && cd -P "$d/../../" && pwd) |
| 6 |
|
| 7 |
. "${CTDB_BASE}/functions" |
| 8 |
|
| 9 |
service_name="vsftpd" |
| 10 |
|
| 11 |
service_reconfigure () |
| 12 |
{ |
| 13 |
# shellcheck disable=SC2317 |
| 14 |
# Called indirectly via ctdb_service_reconfigure() |
| 15 |
service "$service_name" restart |
| 16 |
} |
| 17 |
|
| 18 |
load_script_options |
| 19 |
|
| 20 |
ctdb_setup_state_dir "service" "$service_name" |
| 21 |
|
| 22 |
port_21="vsftpd listening on TCP port 21" |
| 23 |
|
| 24 |
case "$1" in |
| 25 |
startup) |
| 26 |
service "$service_name" stop > /dev/null 2>&1 |
| 27 |
service "$service_name" start |
| 28 |
failcount_init "$port_21" |
| 29 |
;; |
| 30 |
|
| 31 |
shutdown) |
| 32 |
service "$service_name" stop |
| 33 |
;; |
| 34 |
|
| 35 |
takeip|releaseip) |
| 36 |
ctdb_service_set_reconfigure |
| 37 |
;; |
| 38 |
|
| 39 |
ipreallocated) |
| 40 |
if ctdb_service_needs_reconfigure ; then |
| 41 |
ctdb_service_reconfigure |
| 42 |
fi |
| 43 |
;; |
| 44 |
|
| 45 |
monitor) |
| 46 |
if ctdb_check_tcp_ports 21 ; then |
| 47 |
failcount_reset "$port_21" |
| 48 |
else |
| 49 |
# Set defaults, if unset |
| 50 |
: "${CTDB_VSFTPD_MONITOR_THRESHOLDS:=1:2}" |
| 51 |
|
| 52 |
failcount_incr "$port_21" "$CTDB_VSFTPD_MONITOR_THRESHOLDS" |
| 53 |
fi |
| 54 |
;; |
| 55 |
esac |
| 56 |
|
| 57 |
exit 0 |