mirror of
https://github.com/samba-team/samba.git
synced 2025-01-26 10:04:02 +03:00
428e32d647
service_start is currently a variable. This makes passing arguments hard. We change it to be a function and put default definitions into the functions file. We use a convention that if a service name argument is passed to a redefined version of service_start() or service_stop() then it will act unconditionally. If no argument is passed then it can use internal logic to decide if services should really be started. This is useful when a single eventscript handles multiple services. This is a cherry-pick of ae38895 that needed to be reset mid-stream. There is still some breakage following this commit. Signed-off-by: Martin Schwenke <martin@meltin.net> (This used to be ctdb commit 86e4aefed9fd1028660c98e3ea758c2b75ffc1d8)
71 lines
1.2 KiB
Bash
Executable File
71 lines
1.2 KiB
Bash
Executable File
#!/bin/sh
|
|
# event strict to manage vsftpd in a cluster environment
|
|
|
|
. $CTDB_BASE/functions
|
|
|
|
service_name="vsftpd"
|
|
# make sure the service is stopped first
|
|
service_start ()
|
|
{
|
|
service $service_name stop > /dev/null 2>&1
|
|
service $service_name start
|
|
}
|
|
service_stop ()
|
|
{
|
|
service $service_name stop > /dev/null 2>&1
|
|
}
|
|
service_reconfigure="service $service_name restart"
|
|
service_fail_limit=2
|
|
service_tcp_ports=21
|
|
|
|
loadconfig
|
|
|
|
ctdb_start_stop_service
|
|
|
|
is_ctdb_managed_service || exit 0
|
|
|
|
case "$1" in
|
|
startup)
|
|
ctdb_service_start
|
|
;;
|
|
|
|
shutdown)
|
|
ctdb_service_stop
|
|
;;
|
|
|
|
takeip|releaseip)
|
|
ctdb_service_set_reconfigure
|
|
;;
|
|
|
|
recovered)
|
|
# if we have taken or released any ips we must
|
|
# restart vsftpd to ensure that all tcp connections are reset
|
|
if ctdb_service_needs_reconfigure ; then
|
|
ctdb_service_reconfigure
|
|
fi
|
|
;;
|
|
|
|
monitor)
|
|
if ctdb_service_needs_reconfigure ; then
|
|
ctdb_service_reconfigure
|
|
exit 0
|
|
fi
|
|
|
|
if [ -n "$service_tcp_ports" ] ; then
|
|
if ctdb_check_tcp_ports $service_tcp_ports ; then
|
|
ctdb_counter_init
|
|
else
|
|
ctdb_counter_incr
|
|
ctdb_check_counter_limit
|
|
exit 0 # only count 1 failure per monitor event
|
|
fi
|
|
fi
|
|
;;
|
|
|
|
*)
|
|
ctdb_standard_event_handler "$@"
|
|
;;
|
|
esac
|
|
|
|
exit 0
|