1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-14 19:24:43 +03:00
Martin Schwenke 428e32d647 Eventscript function: change service_start into a function.
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)
2011-08-11 10:46:20 +10:00

50 lines
693 B
Bash
Executable File

#!/bin/sh
# event script to manage clamd in a cluster environment
. $CTDB_BASE/functions
detect_init_style
case $CTDB_INIT_STYLE in
redhat)
service_name="clamd"
service_config="clamd"
;;
*)
service_name="clamav"
service_config="clamav"
;;
esac
service_start ()
{
service $service_name stop > /dev/null 2>&1
service $service_name start
}
loadconfig
ctdb_start_stop_service
is_ctdb_managed_service || exit 0
case "$1" in
startup)
ctdb_service_start
;;
shutdown)
ctdb_service_stop
;;
monitor)
ctdb_check_unix_socket ${CTDB_CLAMD_SOCKET} || exit $?
;;
*)
ctdb_standard_event_handler "$@"
;;
esac
exit 0