dont print a lot of log information about shutting down vsftpd
[metze/ctdb/wip.git] / config / events.d / 40.vsftpd
1 #!/bin/sh
2 # event strict to manage vsftpd in a cluster environment
3
4 . $CTDB_BASE/functions
5
6 service_name="vsftpd"
7 # make sure the service is stopped first
8 service_start="service $service_name stop > /dev/null 2>&1 ; service $service_name start"
9 service_stop="service $service_name stop > /dev/null 2>&1"
10 service_reconfigure="service $service_name restart"
11 service_fail_limit=2
12 service_tcp_ports=21
13
14 loadconfig
15
16 ctdb_start_stop_service
17
18 is_ctdb_managed_service || exit 0
19
20 case "$1" in 
21     startup)
22         ctdb_service_start
23         ;;
24
25     shutdown)
26         ctdb_service_stop
27         ;;
28
29     takeip|releaseip)
30         ctdb_service_set_reconfigure
31         ;;
32
33     recovered)
34         # if we have taken or released any ips we must 
35         # restart vsftpd to ensure that all tcp connections are reset
36         if ctdb_service_needs_reconfigure ; then
37             ctdb_service_reconfigure
38         fi
39         ;;
40
41     monitor)
42         if ctdb_service_needs_reconfigure ; then
43             ctdb_service_reconfigure
44             exit 0
45         fi
46
47         if [ -n "$service_tcp_ports" ] ; then
48             if ctdb_check_tcp_ports $service_tcp_ports ; then
49                 ctdb_counter_init
50             else
51                 ctdb_counter_incr
52                 ctdb_check_counter_limit
53                 exit 0 # only count 1 failure per monitor event
54             fi
55         fi      
56         ;;
57
58     *)
59         ctdb_standard_event_handler "$@"
60         ;;
61 esac
62
63 exit 0