blob: 19d40071ce25305e39202b83c691d9cf227ec059 (
plain)
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
|
#!/bin/sh
# event strict to manage vsftpd in a cluster environment
[ -n "$CTDB_BASE" ] || \
CTDB_BASE=$(d=$(dirname "$0") && cd -P "$d" && dirname "$PWD")
. "${CTDB_BASE}/functions"
service_name="vsftpd"
service_reconfigure ()
{
service $service_name restart
}
load_script_options
ctdb_setup_state_dir "service" "$service_name"
case "$1" in
startup)
service "$service_name" stop > /dev/null 2>&1
service "$service_name" start
ctdb_counter_init
;;
shutdown)
service "$service_name" stop
;;
takeip|releaseip)
ctdb_service_set_reconfigure
;;
ipreallocated)
if ctdb_service_needs_reconfigure ; then
ctdb_service_reconfigure
fi
;;
monitor)
if ctdb_check_tcp_ports 21 ; then
ctdb_counter_init
else
ctdb_counter_incr
num_fails=$(ctdb_counter_get)
if [ "$num_fails" -ge 2 ] ; then
die "ERROR: ${num_fails} consecutive failures for vsftpd, marking node unhealthy"
elif [ "$num_fails" -eq 1 ] ; then
echo "WARNING: vsftpd not listening but less than 2 consecutive failures, not unhealthy yet"
fi
fi
;;
esac
exit 0
|