summaryrefslogtreecommitdiffstats
path: root/ctdb/config/events/legacy/40.vsftpd.script
diff options
context:
space:
mode:
Diffstat (limited to 'ctdb/config/events/legacy/40.vsftpd.script')
-rwxr-xr-xctdb/config/events/legacy/40.vsftpd.script57
1 files changed, 57 insertions, 0 deletions
diff --git a/ctdb/config/events/legacy/40.vsftpd.script b/ctdb/config/events/legacy/40.vsftpd.script
new file mode 100755
index 0000000..2d2aac4
--- /dev/null
+++ b/ctdb/config/events/legacy/40.vsftpd.script
@@ -0,0 +1,57 @@
+#!/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 ()
+{
+ # shellcheck disable=SC2317
+ # Called indirectly via ctdb_service_reconfigure()
+ service "$service_name" restart
+}
+
+load_script_options
+
+ctdb_setup_state_dir "service" "$service_name"
+
+port_21="vsftpd listening on TCP port 21"
+
+case "$1" in
+startup)
+ service "$service_name" stop > /dev/null 2>&1
+ service "$service_name" start
+ failcount_init "$port_21"
+ ;;
+
+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
+ failcount_reset "$port_21"
+ else
+ # Set defaults, if unset
+ : "${CTDB_VSFTPD_MONITOR_THRESHOLDS:=1:2}"
+
+ failcount_incr "$port_21" "$CTDB_VSFTPD_MONITOR_THRESHOLDS"
+ fi
+ ;;
+esac
+
+exit 0